I ve been following the exact steps from https://www.youtube.com/watch?v=YjweeM_Bt00
However, when I want to test it in either test or run, it loads only the top bar.
The rest is only white screen.
The preview mode opens correctly but of course doesn't show any data from firebase.
I suspect there is a problem with that but I triple checked every step in there and I just don't know what else to do.
Below is code for home page. any page loads with same problem
Thanks for the help.
import '../backend/backend.dart';
import '../drill_details/drill_details_widget.dart';
import '../flutter_flow/flutter_flow_theme.dart';
import '../flutter_flow/flutter_flow_util.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class HomePageWidget extends StatefulWidget {
const HomePageWidget({Key? key}) : super(key: key);
#override
_HomePageWidgetState createState() => _HomePageWidgetState();
}
class _HomePageWidgetState extends State<HomePageWidget> {
final scaffoldKey = GlobalKey<ScaffoldState>();
#override
Widget build(BuildContext context) {
return Scaffold(
key: scaffoldKey,
appBar: AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryColor,
automaticallyImplyLeading: false,
title: Text(
'Drills',
style: FlutterFlowTheme.of(context).title2.override(
fontFamily: 'Poppins',
color: Colors.white,
fontSize: 22,
),
),
actions: [],
centerTitle: false,
elevation: 2,
),
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
body: SafeArea(
child: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
StreamBuilder<List<DrillsRecord>>(
stream: queryDrillsRecord(),
builder: (context, snapshot) {
// Customize what your widget looks like when it's loading.
if (!snapshot.hasData) {
return Center(
child: SizedBox(
width: 50,
height: 50,
child: CircularProgressIndicator(
color: FlutterFlowTheme.of(context).primaryColor,
),
),
);
}
List<DrillsRecord> listViewDrillsRecordList =
snapshot.data!;
return ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: listViewDrillsRecordList.length,
itemBuilder: (context, listViewIndex) {
final listViewDrillsRecord =
listViewDrillsRecordList[listViewIndex];
return Padding(
padding:
EdgeInsetsDirectional.fromSTEB(16, 12, 16, 12),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 3,
color: Color(0x3D0F1113),
offset: Offset(0, 1),
)
],
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Stack(
children: [
InkWell(
onTap: () async {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DrillDetailsWidget(
docRef: listViewDrillsRecord
.reference,
),
),
);
},
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0),
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
child: Image.network(
'https://cdn.dribbble.com/users/5862142/screenshots/18341547/media/4d62994067420d9a295d8f120b4ed097.jpg?compress=1&resize=1200x900&vertical=top',
width: double.infinity,
height: 200,
fit: BoxFit.cover,
),
),
),
Align(
alignment: AlignmentDirectional(1, -1),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 16, 16, 0),
child: InkWell(
onTap: () async {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DrillDetailsWidget(
docRef: listViewDrillsRecord
.reference,
),
),
);
},
child: Container(
width: 70,
height: 32,
decoration: BoxDecoration(
color: Color(0xFF39D2C0),
borderRadius:
BorderRadius.circular(12),
),
alignment:
AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(16, 0, 16, 0),
child: Text(
'Open',
style:
FlutterFlowTheme.of(context)
.bodyText1
.override(
fontFamily: 'Outfit',
color: Colors.white,
fontSize: 14,
fontWeight:
FontWeight.normal,
),
),
),
),
),
),
),
],
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
12, 12, 12, 4),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
listViewDrillsRecord.drillTitle!,
style: FlutterFlowTheme.of(context)
.title3
.override(
fontFamily: 'Outfit',
color: Color(0xFF101213),
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
],
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
12, 0, 12, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Text(
listViewDrillsRecord.coach!,
style: FlutterFlowTheme.of(context)
.bodyText2
.override(
fontFamily: 'Outfit',
color: Color(0xFF57636C),
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
),
],
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
12, 0, 12, 12),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.star_rounded,
color: Color(0xFFEE8B60),
size: 24,
),
Text(
'4.5',
style: FlutterFlowTheme.of(context)
.bodyText2
.override(
fontFamily: 'Outfit',
color: Color(0xFF57636C),
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
listViewDrillsRecord.price!
.toString(),
style: FlutterFlowTheme.of(context)
.title3
.override(
fontFamily: 'Outfit',
color: Color(0xFF101213),
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
Text(
listViewDrillsRecord
.specialtySport!,
style: FlutterFlowTheme.of(context)
.bodyText2
.override(
fontFamily: 'Outfit',
color: Color(0xFF57636C),
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
],
),
),
],
),
),
);
},
);
},
),
],
),
),
),
),
);
}
}
'''
Related
I'fetching data from my API and want to display the data in a ExpansionPanelList. Now I have the problem, that every time when i want to fold out a Panel it closes immediately. Thanks for helping, here my Code:
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:http/http.dart' as http;
class Job {
final String vorname;
final String nachname;
bool isExpanded;
Job({
required this.vorname,
required this.nachname,
required this.isExpanded,
});
factory Job.fromJson(Map<String, dynamic> json) {
return Job(
vorname: json['vorname'],
nachname: json['nachname'],
isExpanded: false,
);
}
}
Future<List<Job>> fetchJobs() async {
final response = await http.get(Uri.parse('http://10.0.2.2:8000/api/jobs'));
if(response.statusCode == 200){
List jsonResponse = json.decode(response.body);
return jsonResponse.map((data) => Job.fromJson(data)).toList();
} else {
throw Exception('failed to load job');
}
}
class AuftraegePage extends StatefulWidget {
#override
_AuftraegePage createState() => _AuftraegePage();
}
class _AuftraegePage extends State<AuftraegePage>{
String selectedDay = DateFormat('dd.MM.yyyy').format(DateTime.now());
final List<Map<String, dynamic>> _items = List.generate(
10,
(index) => {
'id': index,
'title': 'Max Mustermann',
'description':
'This is the description of the item $index. Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
'isExpanded': false,
});
void _showDatePicker(){
showDatePicker(
locale: const Locale('de', 'DE'),
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1970),
lastDate: DateTime(2050),
builder: (context, child) {
return Theme(
data: ThemeData.light().copyWith(
colorScheme: ColorScheme.light(
primary: Color(0xff1f6526),
onPrimary: Colors.white,
onSurface: Colors.black,
),
dialogBackgroundColor:Colors.white,
),
child: child!,
);
},
).then((value) {
setState(() {
String _dateTime = DateFormat('dd.MM.yyy', 'de_DE').format(value!);
selectedDay = _dateTime;
});
} );
}
#override
Widget build(BuildContext context) {
return Container(
color: Colors.grey[300],
child: SingleChildScrollView(
padding: EdgeInsets.only(left: 16.0, right: 16.0, top: 4.0),
physics: AlwaysScrollableScrollPhysics(),
child: Column(
children: <Widget> [
const SizedBox(height: 20),
const Text('Aufträge',
style: TextStyle(
fontSize: 35,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
buildDatePicker(),
const SizedBox(height: 20),
buildCreateButton(),
const SizedBox(height: 20),
buildListOfJobs(),
],
),
),
);
}
Widget buildListOfJobs(){
return FutureBuilder<List<Job>>(
future: fetchJobs(),
builder: (context, snapshot) {
if(snapshot.hasData){
return ExpansionPanelList(
dividerColor: Colors.grey[700],
elevation: 3,
// Controlling the expansion behavior
expansionCallback: (index, isExpanded) {
setState(() {
snapshot.data![index].isExpanded = !isExpanded;
print(snapshot.data![index].isExpanded);
});
},
animationDuration: Duration(milliseconds: 600),
children: snapshot.data!.map(
(item) => ExpansionPanel(
canTapOnHeader: true,
backgroundColor:
item.isExpanded == true ? Colors.grey[300] : Colors.grey[300],
headerBuilder: (context, isExpanded){
return Container(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.vorname,
style: TextStyle(
fontSize: 18.0,
),
),
SizedBox(height: 5),
Wrap(
children: <Widget>[
Icon(
Icons.access_time_filled,
size: 22.0,
),
SizedBox(
width:5,
),
Text('07:00 - 07:13',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15
),)
],
),
],
)
);
},
body: Container(
color: Colors.grey[300],
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 30),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.user,
size: 19,),
SizedBox(
width:5,
),
Text('Mitglied: OGV Imst ',
style: TextStyle(
fontSize: 15,
),),
],
),
),
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.locationDot,
size: 19),
SizedBox(
width:5,
),
Text('Ort: Imst',
style: TextStyle(
fontSize: 15,
)),
],
),
),
],
),
SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.weightHanging,
size: 19,),
SizedBox(
width:5,
),
Text('Menge: 300 ',
style: TextStyle(
fontSize: 15,
),),
],
),
),
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.wineBottle,
size: 19,),
SizedBox(
width:5,
),
Text('Most: 0',
style: TextStyle(
fontSize: 15,
)),
],
),
),
],
),
SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.bottleDroplet,
size: 19,),
SizedBox(
width:5,
),
Text('Flaschen: 0',
style: TextStyle(
fontSize: 15,
),),
],
),
),
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.bagShopping,
size: 19,),
SizedBox(
width:5,
),
Text('Bag: 0',
style: TextStyle(
fontSize: 15,
)),
],
),
),
],
),
SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.box,
size: 19,),
SizedBox(
width:5,
),
Text('Karton: 0',
style: TextStyle(
fontSize: 15,
),),
],
),
),
],
),
SizedBox(height: 10),
Divider(color: Colors.black,),
SizedBox(height: 10),
Row(
children: [
Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.message,
size: 19,),
SizedBox(
width:5,
),
Text('Anmerkungen: ',
style: TextStyle(
fontSize: 15,
),),
],
),
],
),
SizedBox(height: 10),
Divider(color: Colors.black,),
SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.tasks,
size: 19,),
SizedBox(
width:5,
),
Text('Bestätigt: Nein',
style: TextStyle(
fontSize: 15,
),),
],
),
),
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.xmark,
size: 19,),
SizedBox(
width:5,
),
Text('Stoniert: Nein',
style: TextStyle(
fontSize: 15,
)),
],
),
),
],
),
SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 5,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.eye,
size: 19,),
SizedBox(
width:5,
),
Text('Noshow: Nein',
style: TextStyle(
fontSize: 15,
),),
],
),
),
Expanded(
flex: 4,
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.check,
size: 19,),
SizedBox(
width:5,
),
Text('Erledigt: Nein',
style: TextStyle(
fontSize: 15,
)),
],
),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
flex: 5,
child: ElevatedButton(
onPressed:_showDatePicker,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
elevation: 5,
padding: EdgeInsets.all(13),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
),
child: Wrap(
children: const <Widget>[
Icon(FontAwesomeIcons.edit,
color: Colors.white,
size: 20.0,
),
SizedBox(
width:5,
),
Text(
'Bearbeiten',
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
],
),
),
),
SizedBox(width: 10),
Expanded(
flex: 5,
child: ElevatedButton(
onPressed:_showDatePicker,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.yellow[600],
elevation: 5,
padding: EdgeInsets.all(13),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
),
child: Wrap(
children: <Widget>[
Icon(FontAwesomeIcons.file,
color: Colors.black,
size: 20.0,
),
SizedBox(
width:5,
),
Text(
'Rechnung',
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
),
),
],
),
),
),
],
),
],
),
),
isExpanded: item.isExpanded,
),
).toList(),
);
} else if(snapshot.hasError) {
return Text('${snapshot.error}');
//return Text('keine Daten gefunden');
}
return const CircularProgressIndicator();
},
);
}
Widget buildDatePicker(){
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Datum wählen: ',
style: TextStyle(
fontSize: 20,
),
),
ElevatedButton(
onPressed:_showDatePicker,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[700],
elevation: 5,
padding: EdgeInsets.all(13),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
),
child: Wrap(
children: <Widget>[
Icon(
Icons.date_range,
color: Colors.white,
size: 20.0,
),
SizedBox(
width:5,
),
Text(
selectedDay,
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
],
),
),
],
);
}
Widget buildCreateButton(){
return ElevatedButton(
onPressed:_showDatePicker,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[700],
minimumSize: const Size.fromHeight(50),
elevation: 5,
padding: EdgeInsets.only(left: 35, right: 20, top: 13, bottom: 13),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
),
child: Wrap(
children: <Widget>[
Text(
'Auftrag erstellen',
style: TextStyle(
color: Colors.white,
fontSize: 16.0,
),
),
SizedBox(
width:5,
),
Icon(
Icons.add_card ,
color: Colors.white,
size: 20.0,
),
],
),
);
}
}
I think there could be an issue during fetching the data, because I think with every click my data get reloaded and "isExpanded" is set to *false * again.
You can replace future: fetchJobs() with by creating a state future variable. It will prevent unwanted api call.
late final jobListFuture = fetchJobs();
#override
Widget build(BuildContext context) {
Widget buildListOfJobs(){
return FutureBuilder<List<Job>>(
future: jobListFuture,
as typed above i am trying to display information using a listview but i noticed whenever i port this app to my phone via APK it just shows the background color nothing else! maybe im using expanded wrong or something i have no clue. this app works as intended on my emulator, the emulator im using is pixel 4 api 30
code home_page.dart
class _SummonerProfileRouteState extends State<SummonerProfileRoute> {
List<SummonerRank> SummonerRankList = <SummonerRank>[];
void getSummonerRankfromApi() async {
SummonerRankApi.getSummonerRank(summonerId).then((response) {
setState(() {
Iterable list = json.decode(response.body);
SummonerRankList =
list.map((model) => SummonerRank.fromJson(model)).toList();
});
});
}
String summonerName, summonerId;
int profileIconId, summonerLevel;
_SummonerProfileRouteState(this.summonerName, this.summonerId,
this.profileIconId, this.summonerLevel);
#override
void initState() {
super.initState();
getSummonerRankfromApi();
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: customAppBar(),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
bgColorFront,
bgColorEnd,
],
),
),
child: ListView(
children: [
Expanded(
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 20)),
Text(
summonerName,
style: TextStyle(
fontSize: 35,
fontFamily: 'Spiegel',
fontWeight: FontWeight.bold,
),
),
Text(
"Level ${summonerLevel.toString()}",
style: TextStyle(
fontSize: 20,
color: customColorTextBlue,
),
),
Padding(padding: EdgeInsets.only(top: 10)),
Container(
width: 200,
height: 200,
child: AspectRatio(
aspectRatio: 1 / 1,
child: ClipOval(
child: FadeInImage.assetNetwork(
fit: BoxFit.cover,
placeholder: "images/placeholder.jpg",
image:
"https://ddragon.leagueoflegends.com/cdn/12.22.1/img/profileicon/$profileIconId.png"),
),
),
),
ListView(
shrinkWrap: true,
children: [
GridView.builder(
shrinkWrap: true,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
mainAxisSpacing: 20,
crossAxisSpacing: 20,
crossAxisCount: 2),
itemCount: SummonerRankList.length,
itemBuilder: (BuildContext ctx, index) {
return ListTile(
title: Text(
modeChecker(
SummonerRankList[index].queueType),
style: TextStyle(
fontFamily: 'Spiegel',
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${SummonerRankList[index].tier} ${SummonerRankList[index].rank}",
style: TextStyle(
color: customColorTextBlue,
fontSize: 18,
),
),
Text(
"${SummonerRankList[index].leaguePoints} LP",
style: TextStyle(
color: customColorTextBlue,
fontSize: 18,
),
),
Text(
"${calculateWinrate(SummonerRankList[index].wins, SummonerRankList[index].losses)}% Winrate",
style: TextStyle(
color: customColorTextBlue,
fontSize: 16,
),
),
],
));
}),
],
),
Container(
width: double.maxFinite,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyElevatedButton(
width: 350,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AllChampionsListedRoute(summonerId, summonerName)));
},
borderRadius: BorderRadius.circular(20),
child: Row(
children: [
Spacer(),
Icon(
Icons.call_made_sharp,
color: customColorTextBlue,
size: 26,
),
Padding(padding: EdgeInsets.only(right: 5)),
Text(
'Check champion statistics',
style: TextStyle(
color: customColorTextBlue,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
Spacer(),
],
),
),
],
),
),
],
),
),
],
),
));
}
}
Replace ListView with Column widget. You cant use Expanded inside ListView
return Scaffold(
appBar: customAppBar(),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
bgColorFront,
bgColorEnd,
],
),
),
child: Column( //this
children: [
Expanded(
child: Column(
#override
Widget build(BuildContext context) {
return InkWell(
onTap: ()
{
Navigator.push(context, MaterialPageRoute(builder: (c)=> HistoryDetailScreen(orderID: orderID)));
},
child: FutureBuilder<DocumentSnapshot>(
future: FirebaseFirestore.instance
.collection("orders")
.doc(orderID)
.get(),
builder: (c, snapshot)
{
Map? dataMap;
if(snapshot.hasData)
{
dataMap = snapshot.data!.data()! as Map<String, dynamic>;
totalAmount = dataMap["totalAmount"].toString();
customerName = dataMap["orderBy"].toString();
}
return snapshot.hasData
?
Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 5,),
Text(
"ORDER ID: "+customerName.toString(),
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: "Acme",
),
),
SizedBox(height: 5),
Text(
"Total Amount: ₱" + totalAmount.toString(),
style: const TextStyle(
fontWeight: FontWeight.w500,
color: Colors.black,
fontSize: 16,
fontFamily: "Acme",
),
),
SizedBox(height: 5,),
Text(
"More Info >>",
style: const TextStyle(
color: Colors.grey,
fontSize: 13,
fontFamily: "Acme",
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white
),
padding: const EdgeInsets.all(5),
margin: const EdgeInsets.all(5),
height: itemCount! * 50,
child: Stack(
children: [
Padding(padding: EdgeInsets.all(10)),
ListView.builder(
itemCount: itemCount,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index)
{
Items model = Items.fromJson(data![index].data()! as Map<String, dynamic>);
return Align(
heightFactor: 0.3,
alignment: Alignment.topCenter,
child: placedOrderDesignWidget(model, context, seperateQuantitiesList![index]),
);
},
),
],
),
),
],
),
)
:Center(child: circularProgress(),);
},
),
);
}
}
Widget placedOrderDesignWidget(Items model, BuildContext context, seperateQuantitiesList)
{
return Container(
width: MediaQuery.of(context).size.width,
height: 110,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 3,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(10.0), //add border radius
child: Image.network(model.thumbnailUrl!, width: 90, height: 90, fit: BoxFit.cover,),
),
const SizedBox(width: 10.0,),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Text(
model.name! + " x " + seperateQuantitiesList,
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: "Acme",
),
),
),
const SizedBox(
width: 5,
),
],
),
Text(
"₱ " + model.price.toString(),
style: TextStyle(fontSize: 16.0, color: Colors.blue),
),
],
),
),
],
),
),
);
}
I wanted to avoid the overlapping of data that being shown in my screen
Where is the problem in my code ?
My app works fine in debug mode. But when I go to release mode, Some widgets don't show which placed in stack.
I took internet permission also. <uses-permission android:name="android.permission.INTERNET"/>
Here is my Debug version output that I want.
And here is my release version output
Here is my code -
import 'package:boimarket/model/model.dart';
import 'package:boimarket/screen/pdfscreen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class BookDescription extends StatefulWidget {
BookDescription({Key key, #required this.storyBooksValue}) : super(key: key);
final storyBooksValue;
#override
_BookDescriptionState createState() => _BookDescriptionState();
}
class _BookDescriptionState extends State<BookDescription> {
#override
void initState() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitDown,
DeviceOrientation.portraitUp,
]);
super.initState();
}
#override
void dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitDown,
DeviceOrientation.portraitUp,
]);
}
#override
Widget build(BuildContext context) {
var _boxHeight = MediaQuery.of(context).size.height;
var _boxWidth = MediaQuery.of(context).size.width;
final Color _whiteCream = Color.fromRGBO(250, 245, 228, .8);
final Color _darkBlue = Color.fromRGBO(0, 68, 69, 1);
final Color _lightBlue = Color.fromRGBO(44, 120, 108, 1);
return Scaffold(
appBar: null,
body: Stack(
children: <Widget>[
Container(
color: _lightBlue,
child: Stack(
children: <Widget>[
Card(
elevation: 10,
child: Container(
height: _boxHeight,
width: _boxWidth,
child: FadeInImage.assetNetwork(
fadeOutCurve: Curves.easeInCubic,
placeholder: 'assets/images/cover.jpg',
image: widget.storyBooksValue.imgUrl == null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: widget.storyBooksValue.imgUrl,
height: _boxHeight,
width: _boxWidth,
fit: BoxFit.cover,
),
),
),
Container(
height: _boxHeight,
width: _boxWidth,
color: Colors.black54,
),
Align(
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Column(
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 20, top: 60.0),
child: Expanded(
child: Text(
"এই লেখকের আরও কিছু বই",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white),
overflow: TextOverflow.clip,
),
),
),
Container(
padding: EdgeInsets.only(top: 10, bottom: 10),
height: 250.0,
child: FutureBuilder(
future: fetchBooks(),
builder: (context,
AsyncSnapshot<List<Book>> snapshot) {
if (!snapshot.hasData) {
return Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(
backgroundColor: _whiteCream,
),
Text("Loading"),
],
);
} else {
var writterBooks = snapshot.data
.where((b) =>
b.author ==
widget.storyBooksValue.author)
.toList();
print(writterBooks.length);
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: writterBooks.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Route route = MaterialPageRoute(
builder: (context) =>
BookDescription(
storyBooksValue:
writterBooks[
index]),
);
Navigator.push(context, route);
},
child: Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Container(
width: 100,
height: 140.0,
child: ClipRRect(
borderRadius:
BorderRadius
.circular(5.0),
child: FadeInImage
.assetNetwork(
fadeOutCurve:
Curves.linear,
placeholder:
'assets/images/cover.jpg',
image: writterBooks[
index]
.imgUrl ==
null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: writterBooks[
index]
.imgUrl,
width: 90,
height: 120.0,
fit: BoxFit.cover,
),
),
),
Flexible(
child: Container(
width: 90,
child: Text(
"${writterBooks[index].name}",
style: TextStyle(
color:
Colors.white,
fontWeight:
FontWeight
.bold,
fontSize: 12.0),
overflow:
TextOverflow.clip,
),
),
),
],
),
),
);
});
}
},
),
),
],
),
),
Container(
width: _boxWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40.0),
topRight: Radius.circular(40.0)),
color: _whiteCream,
boxShadow: [
BoxShadow(
color: Colors.black45,
blurRadius: 5.0,
spreadRadius: 1.0)
],
),
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
children: <Widget>[
SizedBox(
height: 30.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "বইয়ের নামঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.name}")
]),
),
SizedBox(
height: 5.0,
),
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "লেখকঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.author}")
]),
),
SizedBox(
height: 5.0,
),
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "বইয়ের ধরণঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.genreClass}")
]),
),
],
),
),
),
Card(
elevation: 5.0,
child: FadeInImage.assetNetwork(
fadeOutCurve: Curves.easeInCubic,
placeholder: 'assets/images/cover.jpg',
image: widget.storyBooksValue.imgUrl ==
null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: widget.storyBooksValue.imgUrl,
height: 100.0,
fit: BoxFit.cover,
),
),
],
),
Divider(),
widget.storyBooksValue.description == null
? Center(
child: Text(
'দুঃখিত, ${widget.storyBooksValue.name} বইটির বর্ণনা পাওয়া যায়নি'))
: SelectableText(
'${widget.storyBooksValue.description} \n',
),
Text(
'আমরা বইটির একটি ebook খুজে পেয়েছি । \n\n আপনি বইটি পড়তে চাইলে, " Read Now " বাটনে ক্লিক করুন । \n'),
SizedBox(
height: 75.0,
)
],
),
),
),
],
),
),
)
],
),
),
Padding(
padding: EdgeInsets.only(left: 10.0, top: 20.0),
child: IconButton(
icon: Icon(Icons.arrow_back),
color: _whiteCream,
onPressed: () {
Navigator.pop(context, false);
}),
),
Positioned(
bottom: 60.0,
right: 20.0,
child: RaisedButton(
onPressed: () {
print("clicked");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PdfScreen(singleBookData: widget.storyBooksValue)),
);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30)),
color: _darkBlue,
child: Text(
"Read now",
style: TextStyle(color: _whiteCream),
),
),
),
],
),
);
}
}
How can I fix this problem? please someone help me.
I solve my problem by remove container of text. Just use text() without container()
Expanded(
child: Text("এই লেখকের আরও কিছু বই",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white),
overflow: TextOverflow.clip,
),
)
For creating a release version of APP you can use android studio,
I am currently working on a flutter project when I create a release version of the app then the app only shows a white blank screen and nothing else, I tried everything to solve this but nothing seems to work, after searching for 2 days I come to know that using android studio we can also create a release version of the app, release version of the app using android studio solved my problem.
My personal choice is the android studio for flutter projects.
Here is the link to the question which I used to create the release version.
How to build signed apk from Android Studio for Flutter
I am using a carousel from the package https://pub.dev/packages/carousel_slider, inside my listview (scrollview). I want to make my images have a round corner border.
I used clipRRect and it works (clip corner image with round border). But something strange happens to my apps. Here my result, I upload to google drive, please download first
https://drive.google.com/open?id=1YNRk3q87-wD080eNvLa9OQ1j2KytvaJW
And here my code
class HomeScreen extends StatelessWidget {
Widget menus(){
return Container(
margin: EdgeInsets.symmetric(horizontal: 21, vertical: 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Layanan favorit',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w700,
),
),
Text(
'Lihat Semua',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Color(0xFFFF2800)
),
),
],
),
Container(
margin: EdgeInsets.only(top: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconMenu(
text: 'Token Listrik',
image: SvgPicture.asset(ICON_ELECTRICITY),
),
IconMenu(
text: 'Pulsa',
image: SvgPicture.asset(ICON_BALANCE),
),
IconMenu(
text: 'Paket Data',
image: SvgPicture.asset(ICON_DATA),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 28),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconMenu(
text: 'Kereta Api',
image: SvgPicture.asset(ICON_TRAIN),
),
IconMenu(
text: 'e Money',
image: SvgPicture.asset(ICON_EMONEY),
),
IconMenu(
text: 'Pasca Bayar',
image: SvgPicture.asset(ICON_POSTPAID),
),
],
),
)
],
),
);
}
Widget offers(){
return Container(
margin: EdgeInsets.symmetric(vertical: 18),
child: Column(
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(horizontal: 21),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Hot offers',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w700,
),
),
Text(
'Lihat Semua',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Color(0xFFFF2800)
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 8),
child: CarouselOffers(),
)
],
),
);
}
#override
Widget build(BuildContext context) {
// TODO: implement build
return SafeArea(
child: Scaffold(
appBar: HomeAppBar(),
body: Container(
child: ListView(
children: <Widget>[
Card(
margin: EdgeInsets.fromLTRB(21, 21, 21, 18),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(20, 11, 20, 11),
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
topLeft: Radius.circular(8.0),
topRight: Radius.circular(8.0)),
color: Theme.of(context).primaryColor
),
child: Row(
children: <Widget>[
Expanded(
child: Container(
child: Text(
'Kasku Balance',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w700
),
),
),
),
Container(
margin: EdgeInsets.only(right: 8),
child: Text(
'Rp 2.000.000',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w700
)
),
),
Container(
child: GestureDetector(
child: Icon(
Icons.refresh,
color: Colors.white,
),
),
),
],
),
),
Container(
padding: EdgeInsets.only(top: 16, bottom: 16),
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0)),
color: Colors.white
),
child: Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
Container(
child: SvgPicture.asset(ICON_TOPUP),
),
Container(
margin: EdgeInsets.only(top: 12),
child: Text(
'Isi Saldo',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 12,
color: Color(0xFF231F20)
),
),
)
],
),
),
Container(
width: 1,
height: 54,
color: Color(0xFFD8D8D8),
),
Expanded(
child: Column(
children: <Widget>[
Container(
child: SvgPicture.asset(ICON_PAY),
),
Container(
margin: EdgeInsets.only(top: 12),
child: Text(
'Bayar',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 12,
color: Color(0xFF231F20)
),
),
)
],
),
),
Container(
width: 1,
height: 54,
color: Color(0xFFD8D8D8),
),
Expanded(
child: Column(
children: <Widget>[
Container(
child: SvgPicture.asset(ICON_TRANSFER),
),
Container(
margin: EdgeInsets.only(top: 12),
child: Text(
'Transfer',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 12,
color: Color(0xFF231F20)
),
),
)
],
),
),
],
),
),
],
),
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
menus(),
offers(),
news(),
news2()
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
title: Text('Jelajah'),
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text('Layanan'),
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text('Transaksi'),
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text('Profile'),
),
],
type: BottomNavigationBarType.fixed,
),
),
);
}
}
class CarouselOffers extends StatefulWidget{
#override
_CarouselOffersState createState() => _CarouselOffersState();
}
class _CarouselOffersState extends State<CarouselOffers> {
int _current = 0;
List<Widget> widgets(){
return ['https://cdn2.tstatic.net/lampung/foto/bank/images/bukalapak-promo-bulan-ramadan_20180511_135232.jpg', 'https://cdn2.tstatic.net/lampung/foto/bank/images/bukalapak-promo-bulan-ramadan_20180511_135232.jpg'].map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 5.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.network(
i,
fit: BoxFit.fill,
),
),
);
},
);
}).toList();
}
#override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
CarouselSlider(
pauseAutoPlayOnTouch: Duration(seconds: 3),
aspectRatio: 16/6,
items: widgets(),
onPageChanged: (index) {
setState(() {
_current = index;
});
},
autoPlay: true,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: map<Widget>(widgets(), (index, url) {
return Container(
width: 6.0,
height: 6.0,
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _current == index ? Theme.of(context).primaryColor : Color.fromRGBO(0, 0, 0, 0.4)
),
);
}),
)
],
);
}
}
what is wrong with my code? any ideas?
Sorry for late answer.
Everything is fine when using real device. I do not know why ClipperRRect not working properly when using emulator (Genymotion).