how to use multi scroll in one screen -Flutter - flutter
I want to create an web ui in flutter like trello in that I want one horizontal primary scroll and one vertical secondary scroll but I am not able to scroll vertically in column I attach what I want to create and my code and if you still not understand please let me know
Here is my code :-
class PlaningWeekScreenWeb extends StatelessWidget {
const PlaningWeekScreenWeb({Key? key}) : super(key: key);
// Use this for set width of card and row in list
final double cardWidth = 180.0;
#override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(child: _getSideMenu()),
Container(
height: Get.height,
width: 1,
color: scrollBarColor,
),
Expanded(
child: _getMainScreen(),
flex: 6,
),
],
);
}
Widget _getMainScreen() {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ListView.builder(
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
padding: EdgeInsets.zero,
itemBuilder: (context, i) {
return Row(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
width: cardWidth,
child: Row(
children: [
(10.0).addWSpace(),
"29".h3(
size: 25,
weight: FontWeight.w700,
color: GrayColor),
(5.0).addWSpace(),
Expanded(
child: "Sun".h3(
color: GrayColor,
weight: FontWeight.w400,
size: 15)),
(10.0).addWSpace(),
],
),
),
Container(
color: scrollBarColor,
height: 1,
width: cardWidth,
),
SizedBox(
width: cardWidth,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleChildScrollView(
primary: false,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
PlaningWeekCard(
device: Device.Web,
onTap: () {},
width: cardWidth,
),
],
),
),
Container(
height: Get.height,
width: 1,
color: scrollBarColor,
),
],
),
),
],
),
],
);
}),
);
}
Widget _getSideMenu() {
return Container(
height: Get.height,
// width: 220,
child: SingleChildScrollView(
padding: EdgeInsets.zero,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Employers".h3(weight: FontWeight.w700, size: 22),
(10.0).addHSpace(),
PerytonSearchField(
hintText: 'Name',
),
(10.0).addHSpace(),
ExpansionTile(
title: Row(
children: [
PerytonCheckBox(val: false),
(5.0).addWSpace(),
Expanded(child: "Codonnier Offieces".expansionTileTittleWeb())
],
),
children: [
_getRow("Norway office"),
_getRow("Surat office"),
_getRow("Bardoli office"),
_getRow("Usa office"),
],
),
(10.0).addHSpace(),
ExpansionTile(
title: Row(
children: [
PerytonCheckBox(val: false),
(5.0).addWSpace(),
Expanded(child: "Codonnier Branches".expansionTileTittleWeb())
],
),
children: [
_getRow("Amsterdam office"),
_getRow("Surat office"),
_getRow("Suart-6 office"),
_getRow("california office"),
],
),
(10.0).addHSpace(),
ExpansionTile(
title: Row(
children: [
PerytonCheckBox(val: false),
(5.0).addWSpace(),
Expanded(
child: "Codonnier sub branches".expansionTileTittleWeb())
],
),
children: [
_getRow("van gogh branch"),
_getRow("Mota varacha branch"),
_getRow("vesu branch"),
_getRow("san francisco office"),
],
),
(10.0).addHSpace(),
"Workers".h3(weight: FontWeight.w700, size: 22),
(10.0).addHSpace(),
PerytonSearchField(
hintText: 'Name',
),
(10.0).addHSpace(),
_getRow("Harsh codonnier"),
(10.0).addHSpace(),
_getRow("Dipak codonnier"),
(10.0).addHSpace(),
_getRow("Subham codonnier"),
(10.0).addHSpace(),
_getRow("ravi codonnier"),
(10.0).addHSpace(),
],
).pSymmetricOnly(horizontal: 10),
),
);
}
Widget _getRow(String name) {
return Row(
children: [
PerytonCheckBox(val: false),
(5.0).addWSpace(),
Expanded(child: name.expansionTileWeb())
],
);
}
}
Here is my card widget:-
class PlaningDayCard extends StatelessWidget {
PlaningDayCard(
{Key? key,
required this.device,
required this.onTap,
required this.width})
: super(key: key);
final Device device;
final double width;
final Function onTap;
#override
Widget build(BuildContext context) {
return ResponsiveWidget(
mobile: _getMobileCard(),
tablet: _getWebCard(),
desktop: _getWebCard(),
device: device);
}
Widget _getWebCard() {
return SizedBox(
width: width - 2,
child: Card(
color: Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.white, width: 0.0),
borderRadius: BorderRadius.circular(15),
),
child: Material(
borderRadius: BorderRadius.circular(15),
clipBehavior: Clip.antiAlias,
color: Colors.transparent,
child: InkWell(
onTap: () {
onTap.call();
},
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: "Scrubbing sinks, tubs, showers"
.h2(weight: FontWeight.w700, size: 15),
),
],
),
(6.0).addHSpace(),
Row(
children: [
ImageAssetIconWithColor(
color: GrayColor,
size: 15,
image: ImageIcons.icTriangle,
),
(8.0).addWSpace(),
Expanded(
child: "Main Office".h2(
weight: FontWeight.w500,
color: GrayColor,
size: 14),
),
],
),
(8.0).addWSpace(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
"09:00—13:00".h2(
weight: FontWeight.w700, color: GrayColor, size: 13),
],
)
],
).pSymmetricOnly(vertical: 5, horizontal: 6),
),
)),
);
}
Widget _getMobileCard() {
return SizedBox(
width: width - 2,
child: Card(
color: Colors.white,
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.white, width: 0.0),
borderRadius: BorderRadius.circular(15.sp),
),
child: Material(
borderRadius: BorderRadius.circular(15.sp),
clipBehavior: Clip.antiAlias,
color: Colors.transparent,
child: InkWell(
onTap: () {
onTap.call();
},
child: Column(
children: [],
),
),
)),
);
}
}
Complete Running Code:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Container(
height: 200,
child: GridView.count(
scrollDirection: Axis.horizontal,
crossAxisCount: 1 ,
children: List.generate(50,(index){
return Container(
child: Card(
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: <Widget>[
Container(
width: 50,
height: 100,
color: Colors.yellowAccent,
),
Container(
width: 50,
height: 100,
color: Colors.blue,
),
Container(
width: 50,
height: 100,
color: Colors.green,
),
Container(
width: 50,
height: 100,
color: Colors.red,
),Container(
width: 50,
height: 100,
color: Colors.yellowAccent,
),
Container(
width: 50,
height: 100,
color: Colors.blue,
),
Container(
width: 50,
height: 100,
color: Colors.green,
),
Container(
width: 50,
height: 100,
color: Colors.red,
)
],
),
color: Colors.amber,
),
);
}),
),
) ),
),
),
);
}
}
Complete Tested Code
import 'dart:math';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
class TrelloExample extends StatefulWidget {
const TrelloExample({Key? key}) : super(key: key);
#override
State<TrelloExample> createState() => _TrelloExampleState();
}
class _TrelloExampleState extends State<TrelloExample> {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Padding(
padding: const EdgeInsets.only(top: 64.0),
child: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: SingleChildScrollView(
physics: const ClampingScrollPhysics(),
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
16,
(index) => SingleChildScrollView(
physics: const ClampingScrollPhysics(),
child: Padding(
padding: EdgeInsets.only(
right: 16.0, left: index == 0 ? 16.0 : 0.0),
child: Column(
children: List.generate(
index % 2 == 1
? 16
: index % 3 == 1
? 8
: index % 1 == 1
? 4
: 6,
(index) => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Material(
elevation: 4.0,
child: Container(
padding: const EdgeInsets.all(38.0),
color: Color(
(Random().nextDouble() * 0xFFFFFF).toInt())
.withOpacity(1.0),
child: Text(
"Trello Ticket Item $index",
style: const TextStyle(
fontSize: 16.0,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
),
),
),
),
),
),
),
),
);
}
}
You can achieve this with more than one ways. But I think the simplest way is that make Row as parent widget put all the ListView in Row after wrapping every ListView by Expanded widget.
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Row(
children: <Widget>[
Expanded(
child: ListView.separated(
itemCount: 10,
controller: ScrollController(),
separatorBuilder: (_, __) => const SizedBox(height: 10),
itemBuilder: ((context, index) => Container(
height: 80,
width: double.infinity,
color: Colors.red,
)),
),
),
const SizedBox(width: 10),
Expanded(
child: ListView.separated(
controller: ScrollController(),
itemCount: 2,
separatorBuilder: (_, __) => const SizedBox(height: 10),
itemBuilder: ((context, index) => Container(
height: 100,
width: double.infinity,
color: Colors.yellow,
)),
),
),
const SizedBox(width: 10),
Expanded(
child: ListView.separated(
controller: ScrollController(),
itemCount: 6,
separatorBuilder: (_, __) => const SizedBox(height: 10),
itemBuilder: ((context, index) => Container(
height: 70,
width: double.infinity,
color: Colors.green,
)),
),
)
],
),
),
);
}
Wrap with SingleChildScrollView over every page you want to scroll.
And also mention the scrollDirection: Axis.vertical.
I hope it works! :)
First must wrap it with a single scroll child view.
Then wrap it in rows,
Then wrap it in a ListView
Use expanded so everything can be seen.
I hope this works for you.
class myScroll extends MaterialScrollBehavior {
#override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}
Related
RenderBox was not laid out: RenderCustomPaint#cd52e relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
class _MainFoodPageState extends State<MainFoodPage> { #override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ Container( //header child: Container( margin: EdgeInsets.only(top: 45, bottom: 15), child: Padding( padding: const EdgeInsets.only(left: 20.0, right: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ BigText( text: "Iran", color: AppColors.mainColor, ), Row( children: [ SmallText( text: "Tehran", color: Colors.black54, ), Icon(Icons.arrow_drop_down) ], ), ], ), Center( child: Container( width: 45, height: 45, child: Icon( Icons.search, color: Colors.white, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: AppColors.mainColor), ), ) ], ), ), ), ), //slider Expanded( child: SingleChildScrollView( child: FoodPageBody(), ), ), ], ), ); } } `--------------------------------------- #override Widget build(BuildContext context) { return Column( children: [ //slider Container( height: 320, child: PageView.builder( controller: pageController, itemCount: itemCount, itemBuilder: (context, position) { return _buildPageItem(position); }), ), //dots DotsIndicator( dotsCount: itemCount, position: _currentPageValue, decorator: DotsDecorator( color: AppColors.mainColor, size: const Size.square(9.0), activeSize: const Size(18.0, 9.0), activeShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0)), ), ), //popular SizedBox( height: 30, ), Container( margin: EdgeInsets.only(left: 30), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ BigText(text: "Popular"), SizedBox( width: 10, ), Container( margin: EdgeInsets.only(bottom: 3), child: BigText( text: ".", color: Colors.black26, ), ), SizedBox( width: 10, ), Container( margin: EdgeInsets.only(bottom: 2), child: SmallText(text: "Food pairing"), ), //list of foods Container( child: ListView.builder( itemCount: 10, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemBuilder: (context, index) { return Container(); }, ), ), ], ), ) ], ); } i cant make a ListView.builder (flutter)
RenderBox was not laid out error in flutter
Im working on flutter where fetching data from api. I want to show shimmer loader while data is loading but its giving "Another exception was thrown: RenderBox was not laid out: RenderFlex#c8a3f relayoutBoundary=up2 NEEDS-PAINT". Please find the below code for your reference and help to resolve. Thanks in advance class HomepageSectionView extends StatelessWidget { const HomepageSectionView({Key? key}) : super(key: key); #override Widget build(BuildContext context) { return Consumer<HomepageSectionProvider>( builder: (context, homepageSectionProvider, child) { return homepageSectionProvider.homepageSectionList.isNotEmpty ? ListView.builder( itemCount: homepageSectionProvider.homepageSectionList.length, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (ctx, index) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.fromLTRB( Dimensions.PADDING_SIZE_SMALL, 20, Dimensions.PADDING_SIZE_SMALL, Dimensions.PADDING_SIZE_SMALL), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( homepageSectionProvider .homepageSectionList[index].title .toString(), style: amberSemibold, ), ], ), ), ConstrainedBox( constraints: homepageSectionProvider .homepageSectionList[index] .subSections! .isNotEmpty ? const BoxConstraints(maxHeight: 150) : const BoxConstraints(maxHeight: 0), child: ListView.builder( itemCount: homepageSectionProvider .homepageSectionList[index] .subSections! .length > 10 ? 10 : homepageSectionProvider .homepageSectionList[index] .subSections! .length, padding: const EdgeInsets.all(0), scrollDirection: Axis.horizontal, shrinkWrap: true, itemBuilder: (BuildContext context, int i) { return InkWell( onTap: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => ProductListByHomepageSection( sectionId: homepageSectionProvider .homepageSectionList[index] .subSections![i] .id .toString(), sectionTitle: homepageSectionProvider .homepageSectionList[index] .subSections![i] .title .toString(), ))); }, child: SizedBox( width: (MediaQuery.of(context).size.width / 1.5) - 5, child: Card( child: SizedBox( width: 300, height: 100, child: Stack(children: [ Container( alignment: Alignment.center, margin: const EdgeInsets.all(5), child: FadeInImage.assetNetwork( placeholder: Images.placeholder, image: homepageSectionProvider .homepageSectionList[index] .subSections![i] .banner, fit: BoxFit.cover, )), Container( alignment: Alignment.center, child: SizedBox( height: 70, width: 120, child: DecoratedBox( decoration: BoxDecoration( borderRadius: const BorderRadius.all( Radius.circular(5)), color: const Color.fromARGB( 232, 115, 22, 1) .withOpacity(0.5)), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( homepageSectionProvider .homepageSectionList[ index] .subSections![i] .title, style: const TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), ), Text( homepageSectionProvider .homepageSectionList[ index] .subSections![i] .bannerText!, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, color: Colors.blueAccent), ), ], ), ), ), ) ]), ), ), ), ); }), ) ], ); }) : HomepageSectionShimmer(isHomeScreen: true); }, ); } } class HomepageSectionShimmer extends StatelessWidget { final bool isHomeScreen; const HomepageSectionShimmer({Key? key, required this.isHomeScreen}) : super(key: key); #override Widget build(BuildContext context) { return ListView.builder( shrinkWrap: true, scrollDirection: isHomeScreen ? Axis.horizontal : Axis.vertical, itemCount: 2, itemBuilder: (context, index) { return Container( margin: const EdgeInsets.all(5), width: 300, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: ColorResources.WHITE, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 1, blurRadius: 5) ]), child: Shimmer.fromColors( baseColor: Colors.grey[300]!, highlightColor: Colors.grey[100]!, enabled: Provider.of<HomepageSectionProvider>(context) .homepageSectionList .isEmpty, child: Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( flex: 4, child: Container( padding: const EdgeInsets.all(Dimensions.PADDING_SIZE_LARGE), decoration: const BoxDecoration( color: ColorResources.ICON_BG, borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)), ), ), ), Expanded( flex: 6, child: Padding( padding: const EdgeInsets.all(Dimensions.PADDING_SIZE_SMALL), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container(height: 20, color: ColorResources.WHITE), const SizedBox( height: Dimensions.PADDING_SIZE_EXTRA_SMALL), Row(children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: 20, width: 50, color: ColorResources.WHITE), ]), ), Container( height: 10, width: 50, color: ColorResources.WHITE), const Icon(Icons.star, color: Colors.orange, size: 15), ]), ]), ), ), ]), ), ); }, ); } }
Try wrapping your listview into Expanded() widget which will allow to take all available space
i need an horizontal and an vertical listView builder in the same page. horizontal at the top and vertical listview at the bottom
This is my code. i need an vertical listview at the top and an horizontal listview at the bottom. top listview shouldn't move with the bottom horizontal listview. My app freezes when i go to this page. i need to stop the main.dart and restart the app.i need a screen something like this. what should i do import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_ecommerce_app/common_widget/BottomNavBarWidget.dart'; import 'package:flutter_ecommerce_app/screens/ShoppingCartPage(p).dart'; class ExpanPrdCat extends StatefulWidget { #override _ExpanPrdCatState createState() => _ExpanPrdCatState(); } class _ExpanPrdCatState extends State<ExpanPrdCat> { bool isLoading = false; #override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 0, centerTitle: true, title: Text('Vegetables'), leading: IconButton( onPressed: () { Navigator.pop(context); }, icon: Icon(Icons.arrow_back_ios_rounded), ), actions: [ IconButton( onPressed: () {}, icon: Icon(Icons.search), color: Color(0xFF323232), ), ], ), // bottomNavigationBar: BottomNavBarWidget(), body: Container( child: Column(children: [ Container( height: 90, child: Padding( padding: const EdgeInsets.only(top: 5, bottom: 5, left: 1, right: 1), child: Container( child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, itemBuilder: (context, index) { return categoryItemsTabs(index); }, itemCount: 5, )), ), ), Container( child: ListView.builder( primary: false, scrollDirection: Axis.vertical, shrinkWrap: true, itemBuilder: (context, index) { return cartItems(index); }, itemCount: 3, ), ) ]), ), ); } //================================================== categoryItemsTabs(int index) { return Stack( alignment: Alignment.center, children: <Widget>[ Container( margin: EdgeInsets.only(right: 3), height: 40, width: 120, decoration: BoxDecoration( image: DecorationImage( image: NetworkImage( "https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/broccoli-in-a-pile-royalty-free-image-593310638-1564523257.jpg"), fit: BoxFit.cover, colorFilter: ColorFilter.mode( Colors.black.withOpacity(0.4), BlendMode.darken)), borderRadius: BorderRadius.circular(15)), ), Container( alignment: Alignment.center, child: Text( "Organic", style: TextStyle( color: Colors.white, fontSize: 15, fontWeight: FontWeight.bold), ), ), ], ); } cartItems(int index) { return Column( children: [ Padding( padding: const EdgeInsets.all(8.0), child: Container( height: 120, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.grey[300], ), child: Padding( padding: const EdgeInsets.all(8.0), child: Row( children: [ Container( width: 80, height: 80, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: DecorationImage( image: NetworkImage( "https://economictimes.indiatimes.com/thumb/height-450,width-600,imgsize-111140,msid-72862126/potato-getty.jpg?from=mdr"), fit: BoxFit.cover)), ), Padding( padding: const EdgeInsets.only(left: 15, top: 15), child: Row( children: [ Container( width: 160, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "potato", style: TextStyle( fontSize: 25, ), overflow: TextOverflow.ellipsis, ), SizedBox( height: 5, ), Text( "malayalam name", style: TextStyle(fontSize: 20), overflow: TextOverflow.ellipsis, ), SizedBox( height: 5, ), Column( children: [ Text("price"), ], ) ], ), ), ], ), ), Row( children: [ Column( children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(05)), height: 20, child: DropdownButton<String>( icon: Icon(Icons.keyboard_arrow_down), underline: SizedBox(), hint: Text("choose"), items: ['1 Kg', '2Kg'].map((String value) { return new DropdownMenuItem<String>( value: value, child: new Text(value), ); }).toList(), onChanged: (_) {}, ), ), SizedBox( height: 50, ), Row( children: [ Container( height: 20, width: 70, child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10)), color: Colors.blue, onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => CartScreen()), ); }, child: Text( " Add", style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w800), ), ), ) ], ) ], ), ], ) ], ), ), ), ) ], ); } }
Just add physics: ClampingScrollPhysics(), in your ListView.builder properties. Example: Container( child: ListView.builder( primary: false, scrollDirection: Axis.vertical, shrinkWrap: true, physics: ClampingScrollPhysics(), itemBuilder: (context, index) { return cartItems(index); }, itemCount: 3, ), )
You can do it using SingleChildScrollView : for horizontal scrolling SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [], ), ), for vertical scrolling SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( children: [], ), ),
return Scaffold( appBar: AppBar(....), body: Container( child: Column(children: [ Container( height: 90, width: MediaQuery.of(context).size.width, child: Padding( padding: const EdgeInsets.only(top: 5, bottom: 5, left: 1, right: 1), child: Container( child: ListView.builder( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { return categoryItemsTabs(index); }, itemCount: 5, ), ), ), ), Expanded( child: Container( child: ListView.builder( scrollDirection: Axis.vertical, itemBuilder: (context, index) { return cartItems(index); }, itemCount: 3, ), ), ) ]), ), );
How to change the text in first screen when there is any change in third screen using provider package in flutter?
I have a firstscreen called including stateful widget, PlantFeatureScreen1 where I have to show the change when the update occurs in thirdscreen which also includes a stateful widget, CartDetais3. How can i update the first screen when changes happens in third screen and addQuantity and subtractQuantity functions will be added in third screen? Please suggest using provider package. firstScreen code Here I have to show the change in very last center widget of this widget tree. class PlantFeatureScreen1 extends StatefulWidget { #override _PlantFeatureScreen1State createState() => _PlantFeatureScreen1State(); } class _PlantFeatureScreen1State extends State<PlantFeatureScreen1> { #override Widget build(BuildContext context) { return Column( children: <Widget>[ TopAppBar(), Expanded( flex: 1, child: Align( alignment: Alignment(-1, 0), child: Container( decoration: BoxDecoration( color: Colors.white, ), child: Text( "Plants", style: TextStyle(fontSize: 30, fontWeight: FontWeight.w700), ), ), ), ), Expanded( flex: 5, child: Container( width: double.infinity, decoration: BoxDecoration( color: Colors.blue, ), child: DefaultTabController( length: 5, child: Column( children: [ Container( height: 50, width: double.infinity, child: TabBar( isScrollable: true, tabs: ourAllLists.tabMaker(), ), ), Container( height: 317, width: double.infinity, decoration: BoxDecoration(color: Colors.white), child: TabBarView( children: ourAllLists.tabViewerMaker(context),),), ], ), ), ), ), Padding( padding: const EdgeInsets.fromLTRB(20, 0, 20, 20), child: Container( alignment: Alignment.bottomRight, height: 120, width: double.infinity, child: Stack( overflow: Overflow.visible, children: [ Container( height: 70, width: 105, decoration: BoxDecoration( color: Color(0xFF96CA2D), borderRadius: BorderRadiusDirectional.horizontal( end: Radius.circular(32), start: Radius.circular(32))), child: Icon(FontAwesomeIcons.shoppingBag,color:Colors.white,size:30), ), Positioned( // top: 0, bottom: 50, right: 0, child: Container( height: 35, width: 35, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(50), border: Border.all(color: Color(0xFF96CA2D),width: 4) ), child: Center(child: Text(ourAllLists.totalquantity().toString(),style:TextStyle(fontSize: 20,color: Color(0xFF96CA2D)))), ), ) ], ), ), ) ], ); } } thirdScreen code Here the update happens when the + or - icons get clicked. class CartDetais3 extends StatefulWidget { #override _CartDetais3State createState() => _CartDetais3State(); } class _CartDetais3State extends State<CartDetais3> { #override Widget build(BuildContext context) { return MaterialApp( home: SafeArea( child: Scaffold( body: Padding( padding: const EdgeInsets.fromLTRB(8, 20, 8, 15), child: Column( children: [ TopAppBar(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "Cart", style: kPlantNameStyle, ), Text( "\$" + "284", style: kItemPrice, ), ], ), Expanded( child: ListView.builder( itemCount: OurAllLists.cartPlantList3.length, itemBuilder: (context, index) { return Card( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 110, width: 100, child: Image(image: AssetImage("assets/tulip.png")), ), Container( height: 80, width: 120, child: Column( children: [ Text(OurAllLists.cartPlantList3[index].pN), Text(OurAllLists.cartPlantList3[index].ca .toUpperCase()), Text("\$ " + OurAllLists.cartPlantList3[index].pr .toString()), ], ), ), Container( height: 120, child: Column( children: [ FlatButton( onPressed: () { setState(() { *here addQuantity function must go* }); }, child: Icon( FontAwesomeIcons.plus, size: 20, ), ), Text(OurAllLists.cartPlantList3[index].qu .toString()), FlatButton( onPressed: () { *here subtractQuantity function must go* }, child: Icon( FontAwesomeIcons.minus, size: 20, ), ), ], )) ], ), ); }), ) ], ), ), ))); } } I have a also a seperate class called ViewTotallItemProvider class ViewTotalItemProvider extends ChangeNotifier{ addQuantity(index){ OurAllLists.cartPlantList3[index].qu++; notifyListeners(); } subtrachQuantity(index){ OurAllLists.cartPlantList3[index].qu--; } }
Fit Container Widget Height to Parent Row Height
I have a web application with the following layout: I am trying to create a flutter application with a similar layout and this is what I have so far: For reproduction purposes, my layout logic is the following (all my code is in the main.dart file for this example): import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { #override Widget build(BuildContext context) { return MaterialApp( title: 'Assemblers Tasks', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.deepOrange, ), home: MyHomePage(title: 'Assembly Tasks'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; #override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { String dropdownValue; List<Map<String, dynamic>> buildItems = []; getBuilds() { List<Map<String, dynamic>> items = []; items.add({"id": 10, "vehicleModel": "A10", "vehicleNumber": "TEST-00010"}); setState(() { buildItems = items; }); } List<Map<String, dynamic>> buildSections = []; getSections() { List<Map<String, dynamic>> items = []; items.add({ "id": 5, "section": "Front", }); items.add({ "id": 15, "section": "Rear", }); setState(() { buildSections = items; }); } Future<List<Map<String, dynamic>>> getSystems(String buildSectionId) async { List<Map<String, dynamic>> items = []; if (int.parse(buildSectionId) == 5) { items.add({ "id": 4, "system": "Hydraulics", }); items.add({ "id": 20, "system": "High Voltage", }); } return items; } #override void initState() { getBuilds(); super.initState(); } #override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Container( padding: EdgeInsets.all(16.0), child: Column( children: <Widget>[ Row( children: <Widget>[ Container( width: 275.0, child: DropdownButton( value: dropdownValue, hint: Text("Choose Build"), isExpanded: true, items: buildItems .map<Map<String, String>>((Map<String, dynamic> item) { String id = item["id"].toString(); String name = item["vehicleModel"] + " " + item["vehicleNumber"]; return {"id": id, "name": name}; }) .toList() .map<DropdownMenuItem<String>>((Map<String, String> item) { return DropdownMenuItem<String>( value: item["id"], child: Text(item["name"]), ); }) .toList(), onChanged: (String newValue) { getSections(); setState(() { dropdownValue = newValue; }); }), ), ], ), Row( children: <Widget>[ Container( width: 150.0, height: 60.0, color: Colors.black, child: Align( alignment: Alignment.center, child: Text( "SECTION", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Container( width: 150.0, height: 60.0, color: Color(0xff444444), child: Align( alignment: Alignment.center, child: Text( "SYSTEM", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Expanded( child: Container( height: 60.0, padding: EdgeInsets.only(left: 36.0), margin: EdgeInsets.only(right: 72.0), color: Color(0xff666666), child: Align( alignment: Alignment.centerLeft, child: Text( "TASK", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), ) ], ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Expanded( child: Container( decoration: BoxDecoration(border: Border.all(color: Colors.black12, width: 1.0, style: BorderStyle.solid)), height: MediaQuery.of(context).size.height - 225, child: ListView.builder( shrinkWrap: true, itemCount: buildSections.length, itemBuilder: (BuildContext context, int index) { String section = buildSections[index]["section"] != null ? buildSections[index]["section"] : ""; String buildSectionId = buildSections[index]["id"].toString(); return Row( children: <Widget>[ Container( width: 150.0, decoration: BoxDecoration( border: Border( right: BorderSide( color: Colors.black12, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), padding: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Align( alignment: Alignment.center, child: Center( child: RotatedBox( quarterTurns: -1, child: Text( section.toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), ), Padding( padding: EdgeInsets.all(12.0), ), Align( alignment: Alignment.center, child: FloatingActionButton( child: Icon(Icons.image), ), ), ], ), ), FutureBuilder( future: getSystems(buildSectionId), builder: (BuildContext context, AsyncSnapshot systemsSnap) { if (systemsSnap.connectionState == ConnectionState.waiting) { return Container( height: 100.0, width: 200.0, child: Text("Please wait..."), ); } else if (systemsSnap.hasError) { return Container( height: 100.0, width: 200.0, child: Text("Oops! There was an error!"), ); } return Row( children: <Widget>[ Container( width: MediaQuery.of(context).size.width - 256.0, child: ListView.builder( shrinkWrap: true, itemCount: systemsSnap.data.length, itemBuilder: (context, index) { Map<String, dynamic> system = systemsSnap.data[index]; String systemName = system["system"]; return Row( children: <Widget>[ Container( padding: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), width: 150.0, decoration: BoxDecoration( border: Border( right: BorderSide( color: Colors.black12, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), child: Column( children: <Widget>[ Align( alignment: Alignment.center, child: RotatedBox( quarterTurns: -1, child: Text( systemName.toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), Padding( padding: EdgeInsets.all(12.0), ), Align( alignment: Alignment.center, child: FloatingActionButton( child: Icon(Icons.image), ), ), ], ), ), ], ); }, ), ), ], ); }, ), ], ); }, ), ), ), Container( padding: EdgeInsets.fromLTRB(16.0, 16.0, 0.0, 0.0), child: Column( children: <Widget>[ Container( child: FloatingActionButton( child: Icon(Icons.photo_library), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.library_books), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.list), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.history), onPressed: () { //TODO action }, ), ), ], ), ), ], ), ], ), ), ); } } The above code is ready to be pasted into the main.dart file and preview on a the virtual device (preferably tablet). So far I have tried the solutions I found on these posts to no avail: - Make container widget fill parent vertically - Flutter Container height same as parent height - Flutter expand Container to fill remaining space of Row - The equivalent of wrap_content and match_parent in flutter? Since the Row that contains the section Container also has a ListView being generated with the FutureBuilder, the height of the Row automatically expands to fit the ListView. I also want the section Container to expand to the same height as the how the Row widget is expanding; i.e., The bottom border of the section Container that says FRONT, should be aligned with the bottom border of the Hight Voltage system and the right border of the FRONT section Container, should go all the way to the top. I already spent 3 days without a resolution. Edit I have tried the suggestion on the answer provided by #MaadhavSharma but I get the following exception: ════════ Exception Caught By rendering library ════════════════════════════ The following assertion was thrown during performLayout(): BoxConstraints forces an infinite height.
I changed a little the structure to make it work, here is the entire build() method: #override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Container( padding: EdgeInsets.all(16.0), child: Column( children: <Widget>[ Row( children: <Widget>[ Container( width: 275.0, child: DropdownButton( value: dropdownValue, hint: Text("Choose Build"), isExpanded: true, items: buildItems .map<Map<String, String>>((Map<String, dynamic> item) { String id = item["id"].toString(); String name = item["vehicleModel"] + " " + item["vehicleNumber"]; return {"id": id, "name": name}; }) .toList() .map<DropdownMenuItem<String>>((Map<String, String> item) { return DropdownMenuItem<String>( value: item["id"], child: Text(item["name"]), ); }) .toList(), onChanged: (String newValue) { getSections(); setState(() { dropdownValue = newValue; }); }), ), ], ), Row( children: <Widget>[ Container( width: 150.0, height: 60.0, color: Colors.black, child: Align( alignment: Alignment.center, child: Text( "SECTION", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Container( width: 150.0, height: 60.0, color: Color(0xff444444), child: Align( alignment: Alignment.center, child: Text( "SYSTEM", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Expanded( child: Container( height: 60.0, padding: EdgeInsets.only(left: 36.0), margin: EdgeInsets.only(right: 72.0), color: Color(0xff666666), child: Align( alignment: Alignment.centerLeft, child: Text( "TASK", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), ) ], ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Expanded( child: Container( decoration: BoxDecoration(border: Border.all(color: Colors.black12, width: 1.0, style: BorderStyle.solid)), height: MediaQuery.of(context).size.height - 225, child: ListView.builder( shrinkWrap: true, itemCount: buildSections.length, itemBuilder: (BuildContext context, int index) { String section = buildSections[index]["section"] != null ? buildSections[index]["section"] : ""; String buildSectionId = buildSections[index]["id"].toString(); return IntrinsicHeight( child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Container( width: 150.0, decoration: BoxDecoration( color: Colors.green, border: Border( right: BorderSide( color: Colors.black12, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), padding: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Align( alignment: Alignment.center, child: Center( child: RotatedBox( quarterTurns: -1, child: Text( section.toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), ), Padding( padding: EdgeInsets.all(12.0), ), Align( alignment: Alignment.center, child: FloatingActionButton( child: Icon(Icons.image), ), ), ], ), ), FutureBuilder( future: getSystems(buildSectionId), builder: (BuildContext context, AsyncSnapshot systemsSnap) { if (systemsSnap.connectionState == ConnectionState.waiting) { return Container( height: 100.0, width: 200.0, child: Text("Please wait..."), ); } else if (systemsSnap.hasError) { return Container( height: 100.0, width: 200.0, child: Text("Oops! There was an error!"), ); } return Container( width: MediaQuery.of(context).size.width - 256.0, child: Column( children: systemsSnap.data.map<Widget>((e) => Container( padding: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), width: 150.0, decoration: BoxDecoration( border: Border( right: BorderSide( color: Colors.black12, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), child: Column( children: <Widget>[ Align( alignment: Alignment.center, child: RotatedBox( quarterTurns: -1, child: Text( e["system"].toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), Padding( padding: EdgeInsets.all(12.0), ), Align( alignment: Alignment.center, child: FloatingActionButton( child: Icon(Icons.image), ), ), ], ), )).toList(), ), ); // Row( // children: <Widget>[ // Container( // width: MediaQuery.of(context).size.width - 256.0, // child: ListView.builder( // shrinkWrap: true, // itemCount: systemsSnap.data.length, // itemBuilder: (context, index) { // Map<String, dynamic> system = systemsSnap.data[index]; // String systemName = system["system"]; // return Row( // children: <Widget>[ // // ], // ); // }, // ), // ), // ], // ); }, ), ], ), ); }, ), ), ), Container( padding: EdgeInsets.fromLTRB(16.0, 16.0, 0.0, 0.0), child: Column( children: <Widget>[ Container( child: FloatingActionButton( child: Icon(Icons.photo_library), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.library_books), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.list), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.history), onPressed: () { //TODO action }, ), ), ], ), ), ], ), ], ), ), ); } Basically I changed the ListView of the second element of the Row for a Column, since it already was inside a ListView and that was making it have double scroll and the heights weren't expanding the height of the row properly, and also I wrapped the Row inside an IntrinsicHeight and put crossAxisAlignment: CrossAxisAlignment.stretch to the Row so the content will fit the height of the Row. The use of IntrinsicHeight is expensive, but I don't see another solution for the way you structured the widgets. I recommend you to try to optimize all the structure so you could find a better and optimal solution.
If you want to stretch the Container to match its parent, use double.infinity for the height and width properties Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Container as a layout')), body: Container( height: double.infinity, width: double.infinity, color: Colors.yellowAccent, child: Text("Hi"), ), ); }
The trick is to use constraints: BoxConstraints.expand() in some of your containers that you want to expand to fill the row height. Try something like this: Scaffold( appBar: AppBar( title: Text("Title"), ), body: Container( padding: EdgeInsets.all(16.0), child: Column( children: <Widget>[ Expanded( flex: 2, child: Container( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), color: Colors.yellow, child: Row( children: <Widget>[ Expanded( flex: 1, child: Container( constraints: BoxConstraints.expand(), color: Colors.blue, child: Text("box 1")), ), Expanded( flex: 2, child: Container( constraints: BoxConstraints.expand(), color: Colors.red, child: Column( children: <Widget>[ Expanded( flex: 2, child: Container( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), color: Colors.yellow, child: Row( children: <Widget>[ Expanded( flex: 1, child: Container( constraints: BoxConstraints.expand(), color: Colors.lightGreen, child: Text("box 2")), ), Expanded( flex: 2, child: Container( constraints: BoxConstraints.expand(), color: Colors.lightBlue, child: Text("box 3")), ), ], ), ), ), Expanded( flex: 1, child: Container( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), color: Colors.yellow, child: Row( children: <Widget>[ Expanded( flex: 1, child: Container( constraints: BoxConstraints.expand(), color: Colors.purple, child: Text("box 4")), ), Expanded( flex: 2, child: Container( constraints: BoxConstraints.expand(), color: Colors.orange, child: Text("")), ), ], ), ), ), ], )), ), ], ), ), ), Expanded( flex: 1, child: Container( padding: EdgeInsets.fromLTRB(0, 0, 0, 0), color: Colors.yellow, child: Row( children: <Widget>[ Expanded( flex: 1, child: Container( constraints: BoxConstraints.expand(), color: Colors.yellow, child: Text("box 5")), ), Expanded( flex: 2, child: Container( constraints: BoxConstraints.expand(), color: Colors.green, child: Text("box 6")), ), ], ), ), ), ], )), );
I think you will need to use some fixed heights since you are using ListView and FutureBuiulders. If you can get rid of FutureBuilders, you can probably achieve dynamic heights. Notice the hright of 320 on the parent row and height of 160 on child rows. But have a look at this: import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { #override Widget build(BuildContext context) { return MaterialApp( title: 'Assemblers Tasks', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.deepOrange, ), home: MyHomePage(title: 'Assembly Tasks'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; #override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { String dropdownValue; List<Map<String, dynamic>> buildItems = []; getBuilds() { List<Map<String, dynamic>> items = []; items.add({"id": 10, "vehicleModel": "A10", "vehicleNumber": "TEST-00010"}); setState(() { buildItems = items; }); } List<Map<String, dynamic>> buildSections = []; getSections() { List<Map<String, dynamic>> items = []; items.add({ "id": 5, "section": "Front", }); items.add({ "id": 15, "section": "Rear", }); setState(() { buildSections = items; }); } Future<List<Map<String, dynamic>>> getSystems(String buildSectionId) async { List<Map<String, dynamic>> items = []; if (int.parse(buildSectionId) == 5) { items.add({ "id": 4, "system": "Hydraulics", }); items.add({ "id": 20, "system": "High Voltage", }); } return items; } #override void initState() { getBuilds(); super.initState(); } #override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Container( padding: EdgeInsets.all(16.0), child: Column( children: <Widget>[ Row( children: <Widget>[ Container( width: 275.0, child: DropdownButton( value: dropdownValue, hint: Text("Choose Build"), isExpanded: true, items: buildItems .map<Map<String, String>>( (Map<String, dynamic> item) { String id = item["id"].toString(); String name = item["vehicleModel"] + " " + item["vehicleNumber"]; return {"id": id, "name": name}; }) .toList() .map<DropdownMenuItem<String>>( (Map<String, String> item) { return DropdownMenuItem<String>( value: item["id"], child: Text(item["name"]), ); }) .toList(), onChanged: (String newValue) { getSections(); setState(() { dropdownValue = newValue; }); }), ), ], ), Row( children: <Widget>[ Container( width: 150.0, height: 60.0, color: Colors.black, child: Align( alignment: Alignment.center, child: Text( "SECTION", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Container( width: 150.0, height: 60.0, color: Color(0xff444444), child: Align( alignment: Alignment.center, child: Text( "SYSTEM", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), Expanded( child: Container( height: 60.0, padding: EdgeInsets.only(left: 36.0), margin: EdgeInsets.only(right: 72.0), color: Color(0xff666666), child: Align( alignment: Alignment.centerLeft, child: Text( "TASK", style: TextStyle( color: Colors.white, fontSize: 17.3, letterSpacing: 1.35, ), ), ), ), ) ], ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Expanded( child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.black12, width: 1.0, style: BorderStyle.solid)), height: MediaQuery.of(context).size.height - 225, child: ListView.builder( shrinkWrap: true, itemCount: buildSections.length, itemBuilder: (BuildContext context, int index) { String section = buildSections[index]["section"] != null ? buildSections[index]["section"] : ""; String buildSectionId = buildSections[index]["id"].toString(); return Container( height: 320, child: Row( children: <Widget>[ Container( width: 120.0, decoration: BoxDecoration( border: Border( right: BorderSide( color: Colors.yellow, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), padding: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Align( alignment: Alignment.center, child: Center( child: RotatedBox( quarterTurns: -1, child: Text( section.toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), ), Padding( padding: EdgeInsets.all(12.0), ), Align( alignment: Alignment.center, child: FloatingActionButton( child: Icon(Icons.image), ), ), ], ), ), Expanded( child: Container( color: Colors.orange, child: false ? Text(" ") : FutureBuilder( future: getSystems(buildSectionId), builder: (BuildContext context, AsyncSnapshot systemsSnap) { if (systemsSnap.connectionState == ConnectionState.waiting) { return Container( height: 100.0, width: 200.0, child: Text("Please wait..."), ); } else if (systemsSnap.hasError) { return Container( height: 100.0, width: 200.0, child: Text("Oops! There was an error!"), ); } return Row( children: <Widget>[ Container( width: MediaQuery.of(context).size.width - 256.0, child: ListView.builder( shrinkWrap: true, itemCount: systemsSnap.data.length, itemBuilder: (context, index) { Map<String, dynamic> system = systemsSnap.data[index]; String systemName = system["system"]; return Row( children: <Widget>[ Container( padding: EdgeInsets.fromLTRB( 0.0, 16.0, 0.0, 16.0), width: 50.0, height: 160, decoration: BoxDecoration( color: Colors.yellow, border: Border( right: BorderSide( color: Colors.red, width: 1.0, ), bottom: BorderSide( color: Colors.black12, width: 1.0, ), ), ), child: Column( children: <Widget>[ Align( alignment: Alignment.center, child: RotatedBox( quarterTurns: -1, child: Text( systemName .toUpperCase(), style: TextStyle( fontSize: 15.0, letterSpacing: 1.2, ), ), ), ), ], ), ), ], ); }, ), ), ], ); }, ), ), ), ], ), ); }, ), ), ), Container( padding: EdgeInsets.fromLTRB(16.0, 16.0, 0.0, 0.0), child: Column( children: <Widget>[ Container( child: FloatingActionButton( child: Icon(Icons.photo_library), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.library_books), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.list), onPressed: () { //TODO action }, ), ), Padding( padding: EdgeInsets.all(10.0), ), Container( child: FloatingActionButton( child: Icon(Icons.history), onPressed: () { //TODO action }, ), ), ], ), ), ], ), ], ), ), ); } }