List builder versus for loops - flutter

I've got a piece of code that -- works! So, not asking for debug help.
I'm three days into learning date and mostly positive, but sometimes hard to find working code examples of things i'm trying to do. So, lots of trial and error. My best advice is to set the background color on every widget to something bold (yellow, green, blue) to help troubleshoot design/layout issues.
But, I read a lot about how to implement something like this: retrieve json data from an API, iterate through it to create a dynamic list of widgets using Future<>. My example is pure flutter web at this time.
The problem is - many sites suggested using List Builder also and for the life of me I could not get it to work. It kept overflowing the bottom of the browser and I could not find any way to extend it. I used a "for Model in List" loop and it worked fine.
So, my question is - if i give you working code, can you suggest a better approach/implementation?
Widget build(BuildContext context) {
return FutureBuilder<List<Menurender>>(
future: fetchMenu(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.none &&
snapshot.hasData == null) {
//print('project snapshot data is: ${projectSnap.data}');
return Container();
}
return Container(
width: MediaQuery.of(context).size.width,
//color: Colors.yellow,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .80,
child: SingleChildScrollView(
child: Column(children: [
for (Menurender menu in snapshot.data)
Column(children: <Widget>[
Row(
children: <Widget>[
//SizedBox(width: 60),
Text(
'${menu.weekDayFull}',
style: TextStyle(
color: Color(0xff444444),
fontSize: 32,
letterSpacing: 2,
fontWeight: FontWeight.w600,
fontFamily: 'Fira Sans'),
),
],
),
Row(
children: <Widget>[
//SizedBox(width: 60),
Column(
children: <Widget>[
Text(
'${menu.dayOfMonth} ${menu.monthFull}',
style: TextStyle(
color: Color(0xff333333),
fontSize: 14,
fontWeight: FontWeight.w400,
fontFamily: 'Fira Sans'),
),
],
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(10.0, 0, 0, 0),
child: Container(
decoration: BoxDecoration(
//color: Colors.red,
border: Border(
bottom: BorderSide(
color: Color(0xff4A4A4A4A)),
)),
),
),
],
))
],
)
])
])),
),
],
),
);
});
}
The actual code working is here so you can see what i'm trying to accomplish:
my test build in progress:
https://flavorboxstorage.z23.web.core.windows.net/#/
actual company wordpress site:
https://www.flavorboxsaigon.com/

Writing a for loop inside your widget tree makes life difficult for Flutter when rebuilding widgets and might affect your performance. You should be able to just use a ListView.builder like this:
ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (context, index) {
return Column(
children: <Widget>[
Row(
children: <Widget>[
//SizedBox(width: 60),
Text(
'${snapshot.data[index].weekDayFull}',
style: TextStyle(
color: Color(0xff444444),
fontSize: 32,
letterSpacing: 2,
fontWeight: FontWeight.w600,
fontFamily: 'Fira Sans'
),
),
],
),
Row(
children: <Widget>[
//SizedBox(width: 60),
Column(
children: <Widget>[
Text(
'${snapshot.data[index].dayOfMonth} ${snapshot.data[index].monthFull}',
style: TextStyle(
color: Color(0xff333333),
fontSize: 14,
fontWeight: FontWeight.w400,
fontFamily: 'Fira Sans'
),
),
],
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(10.0, 0, 0, 0),
child: Container(
decoration: BoxDecoration(
//color: Colors.red,
border: Border(
bottom: BorderSide(
color: Color(0xff4A4A4A4A)
),
)
),
),
),
],
)
)
],
)
]
);
}
)

if you want to use for loop you can just do it like this
ListView(
children: <Widget>[
for(var x=0; x<snapshot.data.length;x++)
Container(
child: Column(children: <Widget>[
Row(
children: <Widget>[
//SizedBox(width: 60),
Text(
'${menu.weekDayFull}',
style: TextStyle(
color: Color(0xff444444),
fontSize: 32,
letterSpacing: 2,
fontWeight: FontWeight.w600,
fontFamily: 'Fira Sans'),
),
],
),
Row(
children: <Widget>[
//SizedBox(width: 60),
Column(
children: <Widget>[
Text(
'${menu.dayOfMonth} ${menu.monthFull}',
style: TextStyle(
color: Color(0xff333333),
fontSize: 14,
fontWeight: FontWeight.w400,
fontFamily: 'Fira Sans'),
),
],
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(10.0, 0, 0, 0),
child: Container(
decoration: BoxDecoration(
//color: Colors.red,
border: Border(
bottom: BorderSide(
color: Color(0xff4A4A4A4A)),
)),
),
),
],
))
)
]
)
if you want ListView.builder
ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (context, index){
return Container(
child: Column(children: <Widget>[
Row(
children: <Widget>[
//SizedBox(width: 60),
Text(
'${menu.weekDayFull}',
style: TextStyle(
color: Color(0xff444444),
fontSize: 32,
letterSpacing: 2,
fontWeight: FontWeight.w600,
fontFamily: 'Fira Sans'),
),
],
),
Row(
children: <Widget>[
//SizedBox(width: 60),
Column(
children: <Widget>[
Text(
'${menu.dayOfMonth} ${menu.monthFull}',
style: TextStyle(
color: Color(0xff333333),
fontSize: 14,
fontWeight: FontWeight.w400,
fontFamily: 'Fira Sans'),
),
],
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(10.0, 0, 0, 0),
child: Container(
decoration: BoxDecoration(
//color: Colors.red,
border: Border(
bottom: BorderSide(
color: Color(0xff4A4A4A4A)),
)),
),
),
],
))
)
]
);
}
)
but for me I make use of map as child of Listview

Related

Wrapping a Row of Texts with Colored Rounded Box

Based on the code below, how does one wrap around a row of texts in a container? (as shown in the image). And also, how to make the container slightly rounded as shown in the image?
When I wrap it in a container, why does it takes up the full width of the app from left to right, which is not what I am trying to achieve.
Thank you in advance.
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Container(
child: Expanded(
child: PageView(
controller: _pageController,
onPageChanged: (page) {
setState(() {
currentIndex = page;
});
},
children: [
SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.only(
top: 0, left: 220, right: 30, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
flex: 7,
child: Text(
'187,177.33',
style: GoogleFonts.openSans(
color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: Text(
'82',
style: GoogleFonts.openSans(
color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
),
],
),
),
],
),
),
],
),
),
),
],
),
);
}
Use decoration on Container. Also reduce the padding,
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(12)),
child: Row(
return Scaffold(
body: Column(
children: [
Container(
child: Expanded(
child: PageView(
// controller: _pageController,
onPageChanged: (page) {
setState(() {
// currentIndex = page;
});
},
children: [
SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(12)),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
flex: 7,
child: Text(
'187,177.33',
style: GoogleFonts.openSans(
color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: Text(
'82',
style: GoogleFonts.openSans(
color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
),
],
),
),
),
],
),
),
],
),
),
),
],
),
);
}
More information about Container and layout
Container has property which called decoration, It would does the job for you, Try this:
Container(
margin: EdgeInsets.all(16),
padding:
EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'187,177.33',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
SizedBox(width: 10),
Text(
'82',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w500),
textAlign: TextAlign.right,
),
],
),
)

A RenderShrinkWrappingViewport expected a child of type RenderSliver but received a child of type RenderFlex

i am new in flutter and firebase integration. i am trying to build mobile app that connect to firestore.
i am trying to use paginate firestore in my mobile app. But i got error message that said "A RenderShrinkWrappingViewport expected a child of type RenderSliver but received a child of type RenderFlex."
this is my code
Widget build(BuildContext context) {
return Container(
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('vendors')
.orderBy('shopName').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapShot) {
if (snapShot.data == null) return CircularProgressIndicator();
if(snapShot.hasData){
print("error");
}
return Padding(
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RefreshIndicator(
child: PaginateFirestore(
bottomLoader: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
Theme.of(context).primaryColor),
),
header: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding:
const EdgeInsets.only(left: 8, right: 8, top: 20),
child: Text(
'All Nearby Stores',
style: TextStyle(
fontWeight: FontWeight.w900, fontSize: 18),
),
),
Padding(
padding:
const EdgeInsets.only(left: 8, right: 8, top: 20),
child: Text(
'Find quality products near you',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
color: Colors.grey),
),
),
],
),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilderType: PaginateBuilderType.listView,
itemBuilder: (index, context, document) => Padding(
padding: const EdgeInsets.all(4),
child: Container(
width: MediaQuery.of(context).size.width,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 120,
height: 100,
child: Card(
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: Image.network(
document['imageUrl'],
fit: BoxFit.fill,
),
),
),
),
SizedBox(
width: 10,
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 35,
child: Text(
document['shopName'],
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
SizedBox(
height: 3,
),
Container(
width:
MediaQuery.of(context).size.width - 250,
child: Text(
document['location'],
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold),
)),
SizedBox(
height: 3,
),
Row(
children: [
Icon(
Icons.star,
size: 12,
color: Colors.grey,
),
SizedBox(
width: 4,
),
Text(
'3.2',
style: TextStyle(
fontSize: 10,
),
)
],
)
],
)
],
),
),
),
query: FirebaseFirestore.instance
.collection('vendors')
.orderBy('shopName'),
listeners: [
refreshChangeListener,
],
footer: Padding(
padding: const EdgeInsets.only(top: 30),
child: Container(
child: Stack(
children: [
Center(
child: Text(
"that's al folks",
style: TextStyle(color: Colors.grey),
),
),
Image.asset(
"image/city.png",
),
Positioned(
right: 10,
top: 80,
child: Container(
width: 100,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'Made By : ',
style: TextStyle(color: Colors.black),
),
Text(
"IZZILLY TEAM",
style: TextStyle(
fontWeight: FontWeight.bold,
letterSpacing: 2,
color: Colors.grey),
)
],
),
))
],
),
),
),
),
onRefresh: ()async{
refreshChangeListener.refreshed = true;
},
)
],
),
);
},
),
);
}
does anyone know how to solve this error?
thank you
According to related issues, something that your code should do is to wrap the header and footer widgets (and other box type widgets) inside a SliverToBoxAdapter. You can refer to this other question and this Github issue to see sample code which resemble yours. Wrapping your header, for example, would look like this according to the related question:
header: SliverToBoxAdapter(
child: Column(
...
),
),
You should also attach logs and error details in your question like those present in the github issue and related question I linked. It would shine more light into the details leading to the error.

How to create simple Listview with image Flutter

I was wondering how I could achieve something similar or close to this
image instead of using cards
any example code would be highly appreciated
Try this code
ListView.builder(
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(width: 10.0),
Image.asset(
'Your Asset',
height: 100,
),
SizedBox(width: 20.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Title Here',
style: TextStyle(
color: Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.w500,
),
),
SizedBox(width: 6.0),
Text(
'Subtitle Here',
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.w300,
),
),
],
),
),
],
),
Divider(
color: Colors.black,
thickness: 1.5,
),
],
);
},
),

I have a problem adding a Text to a Container

I'm new to flutter and new to programming in general. My problem is I can't add this
child: Align(
alignment: Alignment(0, 48),
child: Text(
'SETS',
style: TextStyle(
fontWeight: FontWeight._(4),
fontSize: 18.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
)),
to this code
class _SetupState extends State<Setup> {
#override
Widget build(BuildContext context) {
return Column(children: [
Align(
alignment: Alignment.topCenter,
child: SizedBox(
height: 350.0,
width: 350.0,
child: Container(
margin: const EdgeInsets.only(top: 6.0),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: Color(0xFFE3E3E3),
),
child: Align(
alignment: Alignment.topCenter,
child: Text(
'SET UP YOUR WORKOUT',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
)),
),
)),
]);
}
}
I tried adding it to the container, making a new align but I still didn't manage to succeed.
Thanks for the help!!
I made a layout based on the image provided in the comments:
#override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SizedBox(
height: 350.0,
width: 350.0,
child: Container(
margin: const EdgeInsets.only(top: 6.0),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: Color(0xFFE3E3E3),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'SET UP YOUR WORKOUT',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
),
Column(
children: <Widget>[
Text(
'SETS',
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(
Icons.add
),
Icon(
Icons.remove
),
],
),
),
],
),
Column(
children: <Widget>[
Text(
'WORKS',
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(
Icons.add
),
Icon(
Icons.remove
),
],
),
),
],
),
Column(
children: <Widget>[
Text(
'RESTS',
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16.0,
fontFamily: 'Roboto',
color: Color(0xFF494949)),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(
Icons.add
),
Icon(
Icons.remove
),
],
),
),
],
),
Row(
children: <Widget>[
Expanded(
child: FlatButton(
color: Colors.greenAccent,
child: Text(
'START',
style: TextStyle(
fontSize: 40,
color: Colors.white,
fontWeight: FontWeight.w400
),
),
onPressed: () {
},
shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(30.0)),
),
),
],
)
],
),
),
),
),
);
}
I used a Column(let's name it column1) for the whole grey box, and every one of (SETS, +, -), (WORK, +, -), and (RESTS, +, -) is a Column inside the column1. Every (+, -) is a Row wrapped with a Padding. The Padding is used to make the (+, -) become closer to the center of the box.
There are many ways to make such layout, this is only one.
Result:
if that does not work you can first align it the way you want. Then use padding or margin so that you can have it exactly where you want it be.
Container(
padding:
alignment:
child:Text()
)

how to place image on border of card in flutter?

I am new in flutter , I am sharing an image in which there is card and its border has an image (as you can see the date i.e JULY , 2020 is showing inside an image) . I don't have any idea of how to achieve this functionality . Please help me.
I wrote the below code to create the card. The code is displaying the date image inside the card . Do I need to follow some other widget rather than card and listtile?
BoxDecoration myBoxDecoration() {
return BoxDecoration(
color: Colors.grey[100],
border: Border.all(
width: 1, //
// <--- border width here
),
);
}
Widget _myListView(BuildContext context) {
return new ListView.separated(
padding: const EdgeInsets.all(8),
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(0.0),
child:
Column(
children: <Widget>[
Container(
decoration: myBoxDecoration(),
height: 180,
child :
Card(
child: Ink(
color: Colors.grey[200],
child : ListTile(
onTap: () {
},
title: Column(
children: <Widget>[
Row(
children: <Widget>[
Container(
child:
Center(child: Text('JULY , 2020' , style: TextStyle(
fontWeight: FontWeight.bold ,
fontSize: 20,
color: Colors.white
),),),
width: 190.0,
height: 30,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/apply_leave.png"),
fit: BoxFit.fill,
// alignment: Alignment.center,
),
),
),
Container(
child:Text('' , style: TextStyle(
fontWeight: FontWeight.bold ,
fontSize: 20,
color: Colors.black
),)
)
]
),
SizedBox(height: 20.0),
Expanded(
child :
Row(
children: <Widget>[
Text('FEE SCEDULE' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
)),
SizedBox(width: 80.0),
Text('JULY-SEPT' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
))
])
),
Expanded(
child :
Row(
children: <Widget>[
Text('DUE DATE' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
)),
SizedBox(width: 105.0),
Text('10-06-2020' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
))
])
),
Expanded(
child :
Row(
children: <Widget>[
Text('END DATE' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
)),
SizedBox(width: 105.0),
Text('19-07-2020' , style: TextStyle(
fontWeight: FontWeight.bold ,
color: Colors.black,
))
])
)
]
),
),
),
)
),
Container(
child: Card(
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Total Amount:',style: TextStyle(fontWeight: FontWeight.bold , color: Colors.white),),
Text('254684'+'/-',style: TextStyle(fontWeight: FontWeight.bold , color: Colors.white),),
],
),
),
//
),
)
]
)
);
},
separatorBuilder: (BuildContext context,
int index) => const Divider(),
);
}
If I understand you correctly, you want to put an image above the container with border. You can use Stack for it.
Wrap that container in it and put it at the start of children list, that way it will be displayed below an image, and everything else. Use Positioned to rearrange widgets in stack. You may want to wrap stack in Container to position it better.
Feel free to play with values to get the most desired result:
BoxDecoration myBoxDecoration() {
return BoxDecoration(
color: Colors.grey[100],
border: Border.all(
width: 1, //
// <--- border width here
),
);
}
Widget _myListView(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Container(
decoration: myBoxDecoration(),
height: 180,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Card(
child: Ink(
color: Colors.green[200],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Container(
child: Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.black),
),
),
],
),
SizedBox(height: 20.0),
Expanded(
child: Row(children: <Widget>[
Text('FEE SCEDULE',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
)),
SizedBox(width: 80.0),
Text('JULY-SEPT',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
))
])),
Expanded(
child: Row(
children: <Widget>[
Text('DUE DATE',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
)),
SizedBox(width: 105.0),
Text('10-06-2020',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
))
],
),
),
Expanded(
child: Row(
children: <Widget>[
Text('END DATE',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
)),
SizedBox(width: 105.0),
Text(
'19-07-2020',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
),
)
],
),
)
],
),
),
),
),
),
Padding(
padding: const EdgeInsets.all(3.0),
child: Align(
alignment: Alignment.topLeft,
child: _buildBorderImage(),
),
)
],
),
),
Container(
child: Card(
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Total Amount:',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.white),
),
Text(
'254684' + '/-',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.white),
),
],
),
),
//
),
),
],
),
);
}
Container _buildBorderImage() {
return Container(
child: Center(
child: Text(
'JULY , 2020',
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20, color: Colors.white),
),
),
width: 190.0,
height: 30,
decoration: BoxDecoration(
color: Colors.green,
// image: DecorationImage(
// image: AssetImage("assets/images/apply_leave.png"),
// fit: BoxFit.fill,
// alignment: Alignment.center,
// ),
),
);
}