Flutter - Blockbuilder - Getter received null - flutter

I need to pass several getter through cubit to retieve data for each variable productAnalytics failed to be retrieve as cubit can provide one variable at a time.
When I restructure the Blockbuilder to return each Expand widget, it failes.
What is the best way to retrieve data for each widget in the codes below?
BlocBuilder(
cubit: inventoryBloc,
// cubit:productAnalytics,
builder: (context, state) {
if (state is GetInventoryAnalyticsInProgressState
||
state is GetProductAnalyticsInProgressState) {
return Center(
child: CircularProgressIndicator(),
);
}
if (state is GetInventoryAnalyticsFailedState
||
state is GetProductAnalyticsFailedState
) {
return Text('FAILED');
}
if (state is GetInventoryAnalyticsCompletedState ||
state is GetProductAnalyticsCompletedState
) {
inventoryAnalytics = state.inventoryAnalytics;
productAnalytics = state.productAnalytics;
return
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Material(
child:
InkWell(
splashColor: CompanyColors.color[700].withOpacity(0.5),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AllCategoriesScreen(cartBloc: null, firebaseUser: null, categoryList: [],),
));
},
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 1),
child: Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
CompanyColors.color[100].withOpacity(0.8),
CompanyColors.color[100].withOpacity(0.95),
], ),
// color: CompanyColors.color[500].withOpacity(0.10),
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
width: 1.0,
style: BorderStyle.solid,
color: CompanyColors.color[700].withOpacity(1),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'VOTRE PORTEFEUILLE',
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
color: CompanyColors.color[50],
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
SizedBox(
height: 5.0,
),
Container(
width: 55.0,
height: 55.0,
alignment: Alignment.center,
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: CompanyColors.color[700].withOpacity(0.9),
),
child: Text(
'${inventoryAnalytics.allCategories}',
style: GoogleFonts.poppins(
color: CompanyColors.color[50],
fontSize: 18.0,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(
height: 10.0,
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
// Expanded(
// child: Text(
// '${orderAnalytics.totalOrders}',
// style: GoogleFonts.poppins(
// color: CompanyColors.color[800]87,
// fontSize: 18.0,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
],
),
],
),
),
),
),
),
),
),
SizedBox(
width: 15.0,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Material(
child:
InkWell(
splashColor: CompanyColors.color[600].withOpacity(0.5),
onTap: () {
HapticFeedback.heavyImpact();
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ShopPage()),
);
},
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 1),
child: Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
CompanyColors.color[100].withOpacity(0.7),
CompanyColors.color[100].withOpacity(0.95),
], ),
// color: CompanyColors.color[500].withOpacity(0.10),
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
width: 1.0,
style: BorderStyle.solid,
color: CompanyColors.color[600].withOpacity(1),
),
),
child: Column(
// background:
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'COMMANDER POUR UN CLIENT',
textAlign: TextAlign.center,
overflow: TextOverflow.clip,
style: GoogleFonts.poppins(
color: CompanyColors.color[50],
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
SizedBox(
height: 10.0,
),
Container(
width: 55.0,
height: 55.0,
alignment: Alignment.center,
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: CompanyColors.color[600].withOpacity(0.9),
),
child: Text(
'${productAnalytics.allProducts}',
style: GoogleFonts.poppins(
color: CompanyColors.color[50],
fontSize: 18.0,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(
height: 10.0,
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
],
),
],
),
),
),
),),
),),
],
);
}
return SizedBox();
},
),```

Related

Text not resizing when using AutoSizeText

I'm new to developing in Flutter and I'm having an issue when using AutoSizeText isn't working as i thought it would. You can see on the screen grab that my date text is overflowing.
My code for reference. If anyone could point me in the right direction of where i'm going wrong i would be gladly appreciate it!
body: SafeArea(
child: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0x76168183),
FlutterFlowTheme.of(context).primaryColor
],
stops: [0, 1],
begin: AlignmentDirectional(0, -1),
end: AlignmentDirectional(0, 1),
),
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(10, 10, 10, 0),
child: Container(
decoration: BoxDecoration(
color:
FlutterFlowTheme.of(context).secondaryBackground,
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Color(0xFF168183),
width: 1,
),
),
child: Stack(
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
OrderdateWidget(),
],
),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AutoSizeText(
dateTimeFormat(
'MMMMEEEEd',
getCurrentTimestamp,
locale: FFLocalizations.of(context)
.languageCode,
),
textAlign: TextAlign.center,
style: FlutterFlowTheme.of(context)
.bodyText1
.override(
fontFamily: 'SharpSans',
color: Color(0xFF222F3A),
fontSize: 32,
fontWeight: FontWeight.w800,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyText1Family),
),
),
],
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AutoSizeText(
FFLocalizations.of(context).getText(
'yump08wx' /* Delivery address */,
),
style: FlutterFlowTheme.of(context)
.bodyText1
.override(
fontFamily: 'SharpSans',
color: Color(0xFF222F3A),
fontSize: 16,
fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyText1Family),
),
),
],
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
AutoSizeText(
FFAppState().deliveryAddressName,
textAlign: TextAlign.center,
style: FlutterFlowTheme.of(context)
.bodyText1
.override(
fontFamily: 'SharpSans',
fontSize: 22,
fontWeight: FontWeight.w800,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyText1Family),
),
),
],
),
],
),
],
),
),
),
Expanded(
child: Container(
height: 100,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 5, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
10, 0, 10, 0),
child: Container(
width:
MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.primaryBtnText,
borderRadius:
BorderRadius.circular(5),
border: Border.all(
color: FlutterFlowTheme.of(context)
.primaryColor,
),
),
child: AutoSizeText(
FFLocalizations.of(context).getText(
'61jj7cic' /* Please select point of service... */,
),
textAlign: TextAlign.center,
maxLines: 1,
style: FlutterFlowTheme.of(context)
.bodyText1
.override(
fontFamily: 'SharpSans',
color: Color(0xFF222F3A),
fontSize: 18,
fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyText1Family),
),
),
),
),
),
],
),
),
Expanded(
child: Container(
height: 100,
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
5, 10, 5, 10),
child: Builder(
builder: (context) {
final posGroup =
FFAppState().posGroupJson.toList();
return GridView.builder(
padding: EdgeInsets.zero,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
crossAxisSpacing: 0,
mainAxisSpacing: 10,
childAspectRatio: 3,
),
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: posGroup.length,
itemBuilder: (context, posGroupIndex) {
final posGroupItem =
posGroup[posGroupIndex];
return Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
20, 0, 20, 10),
child: Material(
color: Colors.transparent,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5),
),
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: Color(0xFF168183),
borderRadius:
BorderRadius.circular(5),
border: Border.all(
color: FlutterFlowTheme.of(
context)
.primaryBtnText,
),
),
child: InkWell(
child: InkWell(
onTap: () async {
setState(() =>
FFAppState()
.posGroupName =
getJsonField(
posGroupItem,
r'''$..posGroupName''',
).toString());
setState(() =>
FFAppState()
.posGroupId =
getJsonField(
posGroupItem,
r'''$..posGroupId''',
).toString());
await Navigator.push(
context,
PageTransition(
type:
PageTransitionType
.fade,
duration: Duration(
milliseconds: 0),
reverseDuration:
Duration(
milliseconds:
0),
child:
PointOfServiceWidget(
parmPOSGroupId:
getJsonField(
posGroupItem,
r'''$..posGroupId''',
).toString(),
),
),
);
},
child: Column(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
AutoSizeText(
getJsonField(
posGroupItem,
r'''$..posGroupName''',
).toString(),
style: FlutterFlowTheme
.of(context)
.bodyText1
.override(
fontFamily:
'SharpSans',
color: Colors
.white,
fontSize: 20,
fontWeight:
FontWeight
.w500,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyText1Family),
),
),
],
),
),
),
),
),
);
},
);
},
),
),
),
),
],
),
),
),
],
),
),
],
),
),
),
);
wrap AutoSizeText with Expanded:
Expanded(
child: AutoSizeText(/*...*/),
),

How to get value from reference field in firestore flutter and display in stream builder?

i have a firestore collection named 'orders'. It has user details as field name 'uid'. The field 'uid' is a reference to user data present in 'users' collections. No i have to display username along with order details. So i need to get data from the reference field. i'm using Streambuilder to display data. Here is what i did:
Widget build(BuildContext context) {
Map UserSnapshot = Map();
return Scaffold(
body: StreamBuilder(
stream:_db.collection('users').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> UsersSnapshot) {
UsersSnapshot.data?.docs.forEach((element) {
UserSnapshot[element.id] = element;
});
return StreamBuilder(
stream:_db.collection('orders').where(
'driverId', isEqualTo: sp.getString('uid')).snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> OrdersSnapshot) {
if (!OrdersSnapshot.hasData) return const Text('Loading...');
return ListView.builder(
itemCount: OrdersSnapshot.data!.docs.length,
itemBuilder:(context,index) {
var documentSnapshot= OrdersSnapshot.data!.docs[index].data() as Map<String,dynamic>;
return Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Container(
width: MediaQuery.of(context).size.width,
height: 260,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.black38, width: 1)),
child: Column(
children: [
Row(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
border: Border.all(color: Colors.black12)),
child: Image.network(
'https://indiaeducationdiary.in/wp-content/uploads/2020/10/IMG-20201024-WA0014.jpg')),
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Paradise Multicuisine Restaurant',
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold, fontSize: 14),
overflow: TextOverflow.ellipsis,
),
Text(
'372,Kamarajar Salai, Karaikal',
style: GoogleFonts.poppins(
fontWeight: FontWeight.w400,
fontSize: 11,
color: hexStringToColor('636567')),
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
DottedLine(
dashColor: Colors.black26,
dashGapLength: 10,
),
Padding(
padding: EdgeInsets.all(20),
child: Container(
width: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.account_circle),
SizedBox(
width: 7,
),
Text(
UserSnapshot[documentSnapshot['uid']['fullname']] ?? 'Deleted User',
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w500,
color: hexStringToColor('636567')),
),
SizedBox(width: 3),
Text(
'#'+ documentSnapshot['orderId'],
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w500,
color: hexStringToColor('636567')),
)
],
),
Container(
width: MediaQuery.of(context).size.width * 0.90,
child: Row(
children: [
Icon(Icons.location_on_rounded),
SizedBox(
width: 7,
),
Expanded(
child: Text(
'6/8, RR Colony, Ambedkar Street, Karaikal',
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w500,
color: hexStringToColor('636567')),
overflow: TextOverflow.clip,
maxLines: 4,
),
),
],
),
),
SizedBox(height: 20,),
Row(
children: [
Container(
decoration: BoxDecoration(
color: hexStringToColor('aeaeae'),
borderRadius: BorderRadius.circular(5)
),
width: 80,
height: 20,
child: Row (
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('3 Items',
style: GoogleFonts.poppins(fontSize: 10, fontWeight: FontWeight.w500),
)
],
),
),
SizedBox(width: 20,),
Container(
decoration: BoxDecoration(
color: hexStringToColor('aeaeae'),
borderRadius: BorderRadius.circular(5)
),
width: 80,
height: 20,
child: Row (
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("₹"+documentSnapshot['grandTotal'].toString(),
style: GoogleFonts.poppins(fontSize: 10, fontWeight: FontWeight.w500),
)
],
),
),
],
),
Align(
child: ElevatedButton(onPressed: ()=>{},
child: Text('View Details'),
style: ElevatedButton.styleFrom(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)
),
textStyle: GoogleFonts.poppins(fontWeight: FontWeight.w400,fontSize: 14)
),
),
alignment: Alignment.centerRight,
)
],
),
),
)
],
),
),
);
}
);
}
);
},
)
);
}}
You can iterate over the snapshots using asyncMap.
For example:
stream:_db.collection('users').snapshots().asyncMap((event) async {
event.docs.map((userDoc) {
var userData = userDoc.data() as Map<String, dynamic>;
var referenceSnapshot = userData["someReference"].get();
});
})

How to write text below the container in row

I have always struggled with making this ui dynamically. Its a row of 4 or can be more than 4 containers with images in it and below that row there is text showing the name of the category made. I currently doing the name part with padding's according to my own device but it slips away in larger or smaller screen size devices other than mine. How can I tackle this. Image is also attached for better understanding if required. Also in the next code named intopage I am trying to stick the please read lines and the terms and conditions, privacy policy to the bottom but it isn't sticking
Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
height: 80,
width: 80,
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(color: Colors.black),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Center(
child: Image.asset("assets/salonicon.png",
scale: 1.2, color: Colors.white),
),
),
Container(
height: 80,
width: 80,
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(color: Colors.black),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Center(
child: Image.asset("assets/hairdresser.png",
scale: 1.2, color: Colors.white),
),
),
Container(
height: 80,
width: 80,
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(color: Colors.black),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Center(
child: Image.asset("assets/facial-massage.png",
scale: 1.2, color: Colors.white),
),
),
Container(
height: 80,
width: 80,
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(color: Colors.black),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Center(
child: Image.asset("assets/body-massage.png",
scale: 1.2, color: Colors.white),
),
),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 30.0),
child: Text(
"Salons".toUpperCase(),
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
Padding(
padding: const EdgeInsets.only(left: 50.0),
child: Text(
"Hair".toUpperCase(),
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
Padding(
padding: const EdgeInsets.only(left: 60.0),
child: Text(
"Skin".toUpperCase(),
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
Padding(
padding: const EdgeInsets.only(left: 65.0),
child: Text(
"Body".toUpperCase(),
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
],
),
class IntroPage extends StatelessWidget {
const IntroPage({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF29F76),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Image.asset(
"assets/intropage.png",
fit: BoxFit.fill,
),
Padding(
padding: const EdgeInsets.only(
top: 550,
),
child: Center(
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SignUpPage()));
},
child: Container(
width: 180,
height: 60,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.white,
),
borderRadius:
const BorderRadius.all(Radius.circular(40))),
child: const Center(
child: Text(
"Sign Up",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
),
),
),
),
),
Padding(
padding: const EdgeInsets.only(
top: 650,
),
child: Center(
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SignInPage()));
},
child: Container(
width: 180,
height: 60,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.white,
),
borderRadius:
const BorderRadius.all(Radius.circular(40))),
child: const Center(
child: Text(
"Sign In",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color(0xFFFE6B01)),
),
),
),
),
),
),
Padding(
padding: const EdgeInsets.only(
top: 750,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: 2,
width: 150,
color: Colors.white,
),
const Text(
" Please Read ",
style: TextStyle(color: Colors.white),
),
Container(
height: 2,
width: 150,
color: Colors.white,
),
],
),
),
Padding(
padding: const EdgeInsets.only(
top: 760,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20, top: 6),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
TermsandConditions()));
},
child: const Text(
"Terms & Conditions",
style: TextStyle(
color: Colors.white,
decoration: TextDecoration.underline),
),
),
),
Padding(
padding: const EdgeInsets.only(right: 20, top: 6),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrivacyPolicy()));
},
child: const Text(
"Privacy Policy",
style: TextStyle(
color: Colors.white,
decoration: TextDecoration.underline),
),
),
),
],
),
),
],
)
],
),
),
);
}
}
Use row then columns to specify them according to your needs it took me 3 minutes to change your code according to your needs super easy just practice a couple of times and you won' forget it.
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: <Widget>[
Container(
height: 100.0,
width: 100.0,
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('assets/rnpic.png'),
fit: BoxFit.fill,
),
border: Border.all(color: Colors.black),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Stack(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(),
child: Align(
alignment: Alignment.topRight,
child: Container(
width: 70,
height: 30,
decoration: BoxDecoration(
color: const Color(0xFFFF6D00),
border: Border.all(
color: const Color(0xFFFF6D00)),
borderRadius: const BorderRadius.only(
topRight: Radius.circular(20.0),
)),
child: const Center(
child: Text(
"-50% OFF",
style: TextStyle(color: Colors.white),
),
),
),
),
)
],
),
),
],
),
const SizedBox(
width: 150,
child: Center(
child: Text(
"Colorado Salon special hairstyle",
style:
TextStyle(fontWeight: FontWeight.w500, fontSize: 16),
),
),
),
Container(
width: 80,
height: 30,
decoration: const BoxDecoration(
color: Color(0xFFFF6D00),
borderRadius: BorderRadius.all(Radius.circular(20))),
child: Center(
child: Text(
"View".toUpperCase(),
style: const TextStyle(
fontWeight: FontWeight.w600, color: Colors.white),
),
),
),
],
)
],
),
Make the layout like this
Row(
mainAxisAlignment : MainAxisAlignment.spaceBetween,
children:[
//item 1
Column(
children:[
Icon(),
Text(),
]
),
//item 2
Column(
children:[
Icon(),
Text(),
]
),
//item 3
Column(
children:[
Icon(),
Text(),
]
)
]
)

Align Items inside Row in flutter

I am new to flutter. I trying to design as in the image below. But I could not align the items inside the Row and could not give shape to like the layout below in the image. I have tried giving properties like mainAxisAlignment and crossAxisAlignment but could not get the expected result as in the image below.
Only I could able to get Image below.
I have implemented my code as follows:
Container(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Checkbox(
checkColor: Colors.white,
activeColor: Colors.green,
value: true,
onChanged: (value) {
print(value);
}),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.all(
Radius.circular(20))),
child: Image.network(
bannerWomenFashion[i],
height: 100,
width: 100,
fit: BoxFit.scaleDown,
)),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
Text(
"Rs 1200",
style: TextStyle(
color: CustomColor
.themeSecondary,
fontSize: 18,
fontWeight:
FontWeight.bold),
),
SizedBox(
height: 5,
),
Text(
"The Pursuit of Happiness",
style: TextStyle(
color: Colors.blueGrey,
fontSize: 20,
fontWeight:
FontWeight.bold),
),
SizedBox(
height: 5,
),
Text("ID: #254217",
style: cartBlueGreyStyle),
],
),
),
Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Icon(
Icons.remove,
size: 25,
color: Colors.blueGrey,
),
Container(
width: 30,
height: 25,
decoration: BoxDecoration(
borderRadius:
BorderRadius
.circular(10),
color: Colors.white,
boxShadow: [
BoxShadow(
color:
Colors.grey,
spreadRadius: 2),
],
),
child: Center(
child: Text("1"))),
Icon(
Icons.add,
size: 25,
color: Colors.blueGrey,
),
],
),
],
)),
Container(
width: 30,
height: 30,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(20),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.white,
spreadRadius: 2),
],
),
child: Center(
child: Icon(Icons.clear,
color: Colors.blueGrey),
)),
],
),
],
),
);
Container(
padding: EdgeInsets.all(32.0),
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Stack(
overflow: Overflow.visible,
children: [
Container(
padding: EdgeInsets.all( 8.0),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(12))),
child: Image.network(
'http://covertopia.com/wp-content/uploads/2015/05/000227_Alt.jpg'
/*bannerWomenFashion[i]*/,
height: 100,
fit: BoxFit.scaleDown,
)),
Positioned(
top: -12,
left: -12,
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(color: Colors.green, borderRadius: BorderRadius.all(Radius.circular(12))),
child: Checkbox(
checkColor: Colors.white,
activeColor: Colors.green,
value: true,
onChanged: (value) {
print(value);
}),
),
)
],
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Rs 1200",
style: TextStyle(
color: Colors.red /*CustomColor
.themeSecondary*/
,
fontSize: 18,
fontWeight: FontWeight.bold),
),
SizedBox(height: 10,),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"The Pursuit of Happiness",
style: TextStyle(color: Colors.blueGrey, fontSize: 20, fontWeight: FontWeight.bold),
),
),
),
SizedBox(height: 10,),
Row(
children: [
Text("ID: #254217", style: TextStyle(color: Colors.grey, fontWeight: FontWeight.bold) /*cartBlueGreyStyle*/),
Spacer(),
Row(
children: <Widget>[
Icon(
Icons.remove,
size: 25,
color: Colors.blueGrey,
),
Container(
width: 30,
height: 25,
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
boxShadow: [
BoxShadow(color: Colors.blueGrey.withOpacity(0.1), spreadRadius: 2),
],
),
child: Center(child: Text("1"))),
Icon(
Icons.add,
size: 25,
color: Colors.blueGrey,
),
],
)
],
),
],
),
),
Container(
width: 30,
height: 30,
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.white,
boxShadow: [
BoxShadow(color: Colors.white, spreadRadius: 2),
],
),
child: Center(
child: Icon(Icons.clear, color: Colors.blueGrey,size: 16,),
)),
],
),
),
);

HTML plugin with vertical text flutter

I am trying to show HTML with code with flutter
by use flutter_html: ^0.10.4
import 'package:flutter_html/flutter_html.dart';
but scroll when showing html get yellow error
code
body: Builder(
builder: (BuildContext context) {
return Container(
child: Column(
children: <Widget>[
_buildHeader(context),
loading
? Container(
color: Colors.white,
child: Column(
children: <Widget>[
Container(
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.0, color: Color(0xFFf3b433)),
),
),
child: Container(
padding: const EdgeInsets.symmetric(),
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.0, color: Color(0xFFf3b433)),
),
color: Color(0xFFFFFFFF),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
textDirection: TextDirection.rtl,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: Container(
width:
MediaQuery.of(context).size.width /
2.4,
height:
MediaQuery.of(context).size.height /
25,
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Container(
child: Text(
post.catname == null
? ''
: post.catname,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 16,
color: Colors.black),
),
),
Icon(Icons.arrow_left,
color: Color(0xFFffab40))
],
),
),
onTap: () {
Menu itemSelected = Menu();
itemSelected.setId = post.catid;
itemSelected.setName = post.catname;
itemSelected.setCategoryUrl =
pageUrl.getCategoryUrl(
int.parse(post.catid));
Navigator.of(context).push(
MaterialPageRoute(
builder:
(BuildContext context) =>
ThirdRoute(
itemSelected:
itemSelected)));
},
)
],
)),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: <Widget>[
ListTile(
contentPadding:
EdgeInsets.symmetric(vertical: 30),
title: Text(post.title,
style: TextStyle(
fontSize: MediaQuery.of(context)
.size
.width /
24,
color: Colors.red,
fontWeight: FontWeight.bold),
textDirection: TextDirection.ltr,
textAlign: TextAlign.center),
),
Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.deepOrange, width: 1)),
margin: EdgeInsets.only(
left: MediaQuery.of(context).size.width /
6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Text(post.dateorder)
],
),
),
Container(
decoration: BoxDecoration(
color: Colors.black,
border: Border(
left: BorderSide(
color: Colors.deepOrange))),
width:
MediaQuery.of(context).size.width /
3,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Text(post.since,
style: TextStyle(
color: Colors.white)),
Icon(Icons.timer,
color: Color(0xFFffab40))
],
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 25, bottom: 10),
child: Column(
children: <Widget>[
Container(
width:
MediaQuery.of(context).size.width,
height:
MediaQuery.of(context).size.height /
3.5,
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey[600],
width: 1),
image: DecorationImage(
image:
NetworkImage(post.mainphoto)),
),
)
],
),
),
Container(
height:
MediaQuery.of(context).size.height / 3.5,
width: MediaQuery.of(context).size.width,
child: Html(
data: post.text,
defaultTextStyle:
TextStyle(fontFamily: 'serif'),
backgroundColor: Colors.white70,
padding: EdgeInsets.all(8.0),
),
),
],
),
),
],
),
)
: Container(
child: Center(
child: CircularProgressIndicator(),
),
),
],
));
},
),
I am trying to make it full height content of HTML and style it to rtl style with line height.
HTML will content images, text and YouTube videos.
use ListView instead of Column
like this :
ListView(
childern: <Widget>[
//your widgets
],
);
or wrap your column with SingleChildScrollView like this:
SingleChildScrollView(
child: Column(
childern: <Widget>[
//your widgets
],
),
);