How to center the Widget inside column contained inside Singlechild Scrollview? - android

I am designing a view for creating a group of users from firestore data. I want a view like whatsapp type create a group design. Below is my code :
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.deepOrange,
titleSpacing: 0.0,
centerTitle: true,
automaticallyImplyLeading: true,
leading: _isSearching ? const BackButton() : Container(),
title: _isSearching ? _buildSearchField() : Text("Create Group"),
actions: _buildActions(),
),
body: _buildGroupWidget(),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.deepOrange,
elevation: 5.0,
onPressed: () {
// create a group
createGroup();
},
child: Icon(
Icons.send,
color: Colors.white,
),
),
);
}
Widget _buildGroupWidget() {
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
selectedUserList != null && selectedUserList.length > 0
? Container(
height: 90.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: selectedUserList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
selectedUserList.removeAt(index);
setState(() {});
},
child: Container(
margin: EdgeInsets.only(
left: 10.0, right: 10.0, top: 10.0, bottom: 10.0),
child: Column(
children: <Widget>[
Container(
height: 50.0,
width: 50.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
// color: Colors.primaries[Random().nextInt(Colors.primaries.length)],
color: Colors.primaries[
index % Colors.primaries.length],
),
),
Container(
height: 20.0,
width: 50.0,
child: Center(
child: Text(
selectedUserList[index].userName,
softWrap: true,
overflow: TextOverflow.ellipsis,
),
),
),
],
),
),
);
},
),
)
: Container(),
Container(
alignment: Alignment.centerLeft,
height: 30,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.deepOrange,
boxShadow: [
BoxShadow(
color: Colors.orange, blurRadius: 5, offset: Offset(0, 2)),
],
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Text(
"Contacts",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
),
userList != null && userList.length > 0
? ListView.builder(
shrinkWrap: true,
itemCount: userList.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return ListTile(
onTap: () {
if (selectedUserList.contains(userList[index])) {
selectedUserList.remove(userList[index]);
} else {
selectedUserList.add(userList[index]);
}
setState(() {});
},
title: Text(userList[index].userName),
subtitle: Text(userList[index].userContact),
leading: CircleAvatar(
backgroundColor: Colors.primaries[index],
),
);
},
)
: Center(
child: Text("Data Unavailable!!",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
color: Colors.blueGrey)))
],
),
);
}
The problem with my code is i want to center my last widget which is center widget which will be seen when there is no data. I want to set it to the center of the screen.
But, it not get to the center of the screen.
I have already tried with Expanded, Flex and other solutions from other resource references. But, it doesn't work for me.
Can anyone suggest me how to center my last widget ?

I think expanded should work wrapping your last widget.
Still, if it doesn't work for you then i you can remove the height of your other 2 widgets from full screen as your both widgets have static height which is 120 total here.
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height - 120,
child: Center(
child: Text("Data Unavailable!!",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
color: Colors.blueGrey)),
))
This will solve your issue for your case.

Related

Using carousel slider with page view

I am using carousal slider with page view but when I am sliding the images in scroll view it is sliding to me to next page instead of next image. I just want to slide images when I slide on image and i want to slide to the next page when i slide below the image. but now wherever i slide on the screen it take me to the next page.
This is my page view.
import 'package:bartermade/controllers/profileController.dart';
import 'package:bartermade/models/tradeModel.dart';
import 'package:bartermade/widgets/profileView.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../screens/home/bottomBarViews/homeView/categoriesDetailScreen.dart';
class PageViewHolder extends StatelessWidget {
final PageController pageController = PageController(
initialPage: 0,
);
ProfileController _profileController = Get.find();
final String reciverId;
final String currentUserId;
final TradeModel catData;
PageViewHolder(
{required this.reciverId,
required this.currentUserId,
required this.catData});
var followersList = ['Ali', 'Hussain', 'Hassan', 'Akhtar'];
#override
Widget build(BuildContext context) {
// print("cat ID " + "${catData.user.id}");
// print("profile ID " + "${_profileController.profileId}");
return Scaffold(
body: PageView(
// physics: catData.user.id != _profileController.profileId.value
// ? AlwaysScrollableScrollPhysics()
// : NeverScrollableScrollPhysics(),
physics: ClampingScrollPhysics(),
pageSnapping: false,
onPageChanged: (index) {
},
controller: pageController,
children: [
//first screen in page view
TradeDetailScreen(
catData: catData,
currentUserId: currentUserId,
reciverId: reciverId,
),
//second screen here
ProfileView(
firstName: catData.user.firstName,
lastName: catData.user.lastName,
followers: followersList,
profileUrl: catData.user.profilePictureUrl,
screenState: true,
),
],
),
);
}
}
And this is my screen page
#override
Widget build(BuildContext context) {
return Scaffold(
body: LayoutBuilder(
builder: (context, constraints) {
return OrientationBuilder(
builder: (context, orientation) => SafeArea(
child: SingleChildScrollView(
child: Column(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
onPressed: () {
Get.back();
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.grey,
)),
Container(
clipBehavior: Clip.antiAlias,
height: 50,
width: 50,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: '${widget.profileUrl}',
placeholder: (context, url) =>
Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) =>
Icon(Icons.error),
),
),
SizedBox(
width: 7,
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"${widget.lastName ?? " " "${widget.firstName ?? " "}"}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: (MediaQuery.of(context)
.size
.height /
100) *
2),
),
widget.catData["user"] ==
profileController.userId.value
? Container(
height: 0,
width: 0,
)
: Container(
padding: EdgeInsets.all(5),
child: Center(
child: Text(
'Follow',
style: TextStyle(
color: Colors.white,
fontSize: 12),
),
),
//width: 50,
decoration: BoxDecoration(
color: AppColors.pinkAppBar,
borderRadius: BorderRadius.all(
Radius.circular(20)))),
],
),
Row(
//crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'4.3',
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: (MediaQuery.of(context)
.size
.height /
100) *
1.8),
),
Icon(
Icons.star,
size: 15,
color: Colors.yellow,
),
],
),
],
),
)
],
),
),
Column(
children: [
widget.catData["pictures"] == [] ||
widget.catData["pictures"].length == 0 ||
widget.catData["pictures"].isEmpty ||
widget.catData["pictures"] == null
? Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height * 0.6,
child: Center(child: Text(" No Image to show")))
: Stack(
children: [
CarouselSlider(
items: widget.catData["tradeWithPictures"]
.map<Widget>((e) {
return Container(
width: Get.width,
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: e['url'],
placeholder: (context, url) => Center(
child: CircularProgressIndicator()),
errorWidget: (context, url, error) =>
Icon(Icons.error),
),
);
}).toList(),
carouselController:
postController.carouselController,
options: CarouselOptions(
autoPlay: true,
enableInfiniteScroll: true,
height: Get.height * .7,
viewportFraction: 1.0,
enlargeCenterPage: false,
aspectRatio: 1 / 1.3,
onPageChanged: (index, reason) {
// postController.tradeImagesIndex(index);
// postController.carouselController.nextPage();
},
),
),
Positioned(
top: MediaQuery.of(context).size.height * 0.3,
bottom:
MediaQuery.of(context).size.height * 0.3,
left: 0,
right: 0,
child: Container(
padding:
EdgeInsets.symmetric(horizontal: 10),
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
child: Icon(Icons.arrow_back_ios),
style: ButtonStyle(
splashFactory:
NoSplash.splashFactory,
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(25.0),
side: BorderSide(
color: AppColors.pinkColor),
),
),
),
onPressed: () {
postController.carouselController
.previousPage();
},
),
ElevatedButton(
child: Icon(Icons.arrow_forward_ios),
style: ButtonStyle(
splashFactory:
NoSplash.splashFactory,
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(25.0),
side: BorderSide(
color: AppColors.pinkColor),
),
),
),
onPressed: () {
postController.carouselController
.nextPage();
},
),
],
),
),
),
],
),
SizedBox(
height: 10,
),
],
),
Container(
margin: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.catData["title"],
style: TextStyle(
color: AppColors.detailTextsColor,
fontWeight: FontWeight.bold),
),
profileController.userId == widget.catData["user"]
? Container(
height: 0,
width: 0,
)
: InkWell(
onTap: () {
},
child: Container(
padding: EdgeInsets.all(5),
child: Center(
child: Text(
'Offer Trade',
style: TextStyle(
color: Colors.white,
fontSize: 12),
),
),
//width: 50,
decoration: BoxDecoration(
color: AppColors.pinkAppBar,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
),
),
],

use textField and listview.builder in bottom sheet

Hey everyone I'm new to flutter and I have a problem.
I want to create an application that users after tapping on the Btn the bottom sheet will be open and after that ( here problem ) show the text field(for search) and the listView.
problem: when I do this nothing show me( even the bottom sheet don't appear)
this is my code :
enter code here
GestureDetector(
onTap: () {
showModalBottomSheet(
// ---------------------//
context: context,
builder: (context) {
return Container(
color: Color(0xff737373),
// to make the radius visible
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).canvasColor,
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10))),
child: countriesInfo == null
? Center(
child: CircularProgressIndicator(),
)
: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText: 'country',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
),
),
),
ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
_selectItem(countriesInfo[index]);
},
child: Container(
padding: EdgeInsets.only(left: 10, right: 10),
height: 50,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [BoxShadow(color: Colors.grey, blurRadius: 10, offset: Offset(0, 10))],
),
child: Row(
children: [
Image.network(
countriesInfo[index]._flag,
width: 50,
height: 50,
),
Text(
countriesInfo[index]._name,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
],
), // name of the country
),
);
},
itemCount: countriesInfo == null ? 0 : countriesInfo.length,
),
],
)),
);
}); // end bottom nav
},
child: Container(
width: double.infinity,
margin: EdgeInsets.all(35),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(color: Color(0xFFA3A3A3), borderRadius: BorderRadius.all(Radius.circular(15))),
child: Center(
child: Text(
"${selectedCountry == null ? countriesInfo[0].name : selectedCountry!.name.toString()}",
style: TextStyle(fontSize: 18),
),
),
),
),
if know any documentation or idea tell me please thank you.

I have a problem with the spaces on Flutter

I can't understand what I'm doing wrong.
I have created a small detail page for an application that I am developing on vegan recipes.
I have a space that I can't take away and I don't understand what generated it. Space is what you see circled in red.
Can you help me ?
Thank you,
Vincenzo
class _CookDetailState extends State<CookDetail> {
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
title: Text(this.widget.ricetta.title),
backgroundColor: AppColors.darkModeBackgroundColor),
body: Stack(
children: <Widget>[
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Hero(
tag: this.widget.ricetta.title,
child: Container(
decoration:
BoxDecoration(image: DecorationImage(image: NetworkImage("https://cdn.pixabay.com/photo/2017/09/16/19/21/salad-2756467__340.jpg"),
fit: BoxFit.cover)),
),
),
),
// white container
Positioned(
left: 24.0,
right: 24.0,
bottom: 16.0,
child: Container(
//height: MediaQuery.of(context).size.height * 0.75,
//height: 650,
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 100, sigmaY: 200),
child: Container(
padding: EdgeInsets.all(16.0),
height: 500,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0), color: Colors.white.withOpacity(0.2)),
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16.0),
height: 800,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0), color: Colors.white.withOpacity(0.2)),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
this.widget.ricetta.title,
style: TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold),
),
Spacer(),
Icon(
Icons.favorite_border,
size: 24.0,
color: Colors.white,
),
],
),
new Container(
child: ListView(
shrinkWrap: true,
children: <Widget>[
this._generateList(this.widget.ricetta.listIngredieti),
this._generateStep(this.widget.ricetta.listPassaggio),
],
),
),
],
),
),
),
),
),
),
),
),
],
),
);
}
Widget _generateList(List<Ingrediente> listIngrediente){
return Column(
children: <Widget>[
for ( var myElement in listIngrediente ) Text(
myElement.title + " " + myElement.quantita,
style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w600))
],
);
}
Widget _generateStep(List<StepRicetta> listStep){
return Column(
children: <Widget>[
for (var myStep in listStep) CheckboxListTile(title: AutoSizeText(myStep.title),
value: false, onChanged: (bool selected){
print("Valore selected");
},
secondary: const Icon(Icons.hourglass_empty),
)
],
);
}
}
My concept would be to leave the writing "Recipe 1", blocked, scrolling only and exclusively the list concerning the list of ingredients, such as "Put the bread", "Put 300 g of water"
I think your second EdgeInsets.all(16.0) create the space, do you have try this : EdgeInset.only(left: 16.0, right: 16.0) ?

make a gridview inside list view Flutter , and just end with this error

[Widget _builtCard() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10.0),
child: FutureBuilder(
future: dbManager.getCategoryList(),
builder: (context, snapshot) {
if (snapshot.hasData) {
categoryList = snapshot.data;
print("object");
return ListView.builder(
itemCount: categoryList.length,
physics: ScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>\[
Container(
margin:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 5.0),
child: Text(
categoryList\[index\].categoryName.toUpperCase(),
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20.0),
),
),
AspectRatio(
aspectRatio: 2 / 3,
child: Container(
child: FutureBuilder(
future: dbManager
.getProductList(categoryList\[index\].categoryName),
builder: (context, snapshot) {
if (snapshot.hasData) {
productList = snapshot.data;
productList.forEach((row) => print(row));
return GridView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.horizontal,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: 4 / 2.5,
crossAxisCount: 2,
crossAxisSpacing: 15.0,
mainAxisSpacing: 15.0),
shrinkWrap: true,
itemCount: productList == null
? 0
: productList.length,
itemBuilder:
(BuildContext context, int index) {
Product prod = productList\[index\];
return GestureDetector(
child: Card(
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10.0)),
elevation: 7.0,
child: Column(
children: <Widget>\[
SizedBox(height: 12.0),
Stack(children: <Widget>\[
Container(
height: MediaQuery.of(context)
.size
.height /
5,
width: MediaQuery.of(context)
.size
.width,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
20.0),
image: DecorationImage(
image: NetworkImage(
prod.picture))),
),
\]),
SizedBox(height: 20.0),
Text(
prod.name,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Quicksand',
fontWeight: FontWeight.bold,
fontSize: 16.0,
),
maxLines: 1,
),
SizedBox(height: 5.0),
Text(
'Rp ${prod.price.toString()}',
style: TextStyle(
fontFamily: 'Quicksand',
fontWeight: FontWeight.bold,
fontSize: 15.0,
color: Colors.grey),
),
SizedBox(height: 10.0),
Expanded(
child: InkWell(
onTap: () {
showModalBottomSheet(
isScrollControlled: true,
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.only(
topLeft:
Radius.circular(40),
topRight:
Radius.circular(40),
)),
context: context,
builder: (BuildContext bc) {
return Container(
height: MediaQuery.of(
context)
.size
.height *
.75,
child: Padding(
padding:
const EdgeInsets
.all(12.0),
child:
SingleChildScrollView(
child: Column(
children: <
Widget>\[
Center(
child: Image
.network(
prod.picture)),
Padding(
padding:
const EdgeInsets
.all(
8.0),
child: Center(
child: Text(
'${prod.name}',
style: TextStyle(
letterSpacing:
1.5,
fontSize:
15,
fontWeight:
FontWeight.bold),
),
),
),
Padding(
padding:
const EdgeInsets
.all(
8.0),
child: Center(
child: Text(
'Rp ${prod.price}'),
),
),
Padding(
padding:
const EdgeInsets
.all(
8.0),
child: Center(
child: Text(
'${prod.detail}'),
),
),
Center(
child:
RaisedButton(
child: Text(
'Add to cart'),
color: Colors
.lightGreen,
textColor:
Colors
.white,
onPressed:
() {
_addToCart(
prod.id,
prod.name,
prod.price,
prod.picture);
},
),
),
\],
),
),
),
);
});
},
child: Container(
width: 175.0,
decoration: BoxDecoration(
color:
prod.price.toString() ==
'Away'
? Colors.grey
: Colors.lightGreen,
borderRadius: BorderRadius
.only(
bottomLeft:
Radius.circular(
10.0),
bottomRight:
Radius.circular(
10.0)),
),
child: Center(
child: Text(
'Check Detail',
style: TextStyle(
color: Colors.white,
fontFamily:
'Quicksand'),
),
)),
))
\],
),
),
);
});
}
return Container(
child: Center(
child: new CircularProgressIndicator(),
),
);
},
),
),
),
\],
);
},
);
}
return Container(
child: Center(
child: new CircularProgressIndicator(),
),
);
},
),
);
}][1]
Is it possible to do it like this ? and than here is where the query to get the Data.
Please guys help me to solve this problem , your answer very help me a lot Thank you .
I dont know sometimes it just show properly but sometimes it will show like that error randomly .
I want my content change dynamicly by the category title

Problem Scrolling or "nested scrolling" within a ListView in Flutter

So as you can in the video attached, there is a problem in scrolling. It should be like an infinite scroll view (like on facebook's app news feed)
The problem is there seems to be a "nested" scroll within the parent ListView. How can I fix this? Please assist
VIDEO HERE (I don't know how to attach a video here so I put it on youtube)
my homepage code is this where the More Offers section should just be generating datas from the firebase backend continously like on facebook's news feed:
#override
Widget build(BuildContext context) {
width = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
backgroundColor: Color(0xFF0d192a),
appBar: CustomAppBar(height: 60),
// appBar: CustomAppBar(height: 70),
drawer: DrawerNiVlad(),
body: ListView(
//vlad
children: <Widget>[
// some widgets here
ArlTitleText('More Offers'),
MoreOffers(), <= The widget that has a "nested scroll"
sb5,
the MoreOffers widget code
Widget build(BuildContext context) {
return StreamBuilder(
initialData: List<DiscountEntity>(),
stream: _moreOffersBloc.listDiscounts3Flux,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) return Container(height: 1, width: 1);
return ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0),
scrollDirection: Axis.vertical,
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
DiscountEntity discount =
snapshot.data[index] as DiscountEntity;
return Container(
decoration: BoxDecoration(
// border: Border(bottom: BorderSide()),
),
child: Card(
color: Color(0xFF0d192a),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0, vertical: 5.0),
child: Stack(
children: <Widget>[
InkWell(
onTap: () {
print('123123');
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailsDiscountPage(
discount: discount,
),
),
);
}, // button pressed
child: Container(
width: 100.0,
height: 100.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(5.0)),
color: Colors.black,
),
child: Image.network(
// 'asdkmnajhkalskca',
discount.imageUrl.Url,
fit: BoxFit.cover,
loadingBuilder: (BuildContext context,
Widget child,
ImageChunkEvent loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor:
AlwaysStoppedAnimation<Color>(
goldColor),
value: loadingProgress
.expectedTotalBytes !=
null
? loadingProgress
.cumulativeBytesLoaded /
loadingProgress
.expectedTotalBytes
: null,
),
);
},
),
),
),
Positioned(
left: 110,
top: 1,
child: InkWell(
onTap: () {
print('asdasdasdas');
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailsDiscountPage(
discount: discount,
),
),
);
}, // button pressed
child: Container(
child: Text(
discount.name,
style: TextStyle(
color: goldColor,
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.bold),
),
),
),
),
Positioned(
left: 110,
top: 17,
child: Container(
child: Text(
// discount.type,
'category',
style: TextStyle(
color: Color(0xff7a7a7a),
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.normal),
),
),
),
Positioned(
left: 110,
top: 35,
child: Container(
child: Row(
children: <Widget>[
Icon(
Icons.calendar_today,
color: Color(0xff7a7a7a),
size: 15,
),
Text(
'Jan 1, 2020 - Dec 1, 2020',
style: TextStyle(
color: Color(0xff7a7a7a),
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.normal),
),
],
)),
),
],
),
)),
);
},
);
});
In your ListView.builder, add a primary property and set its value to false
return ListView.builder(
primary: false, // add this line
shrinkWrap: true,
... etc ...
);

Categories

Resources