Flutter i have a column i am showing widgets in this. But there is one issue that container isn't showing in full screen there is some white black space remaining.
My code
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Header Image
Container(
width: double.infinity,
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(podcastInfo.artworkUrl600),
fit: BoxFit.fill,
),
),
child: Container(
margin: EdgeInsets.only(left: 10, top: 15),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(),
Spacer(),
],
),
),
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: mainHeading(podcastInfo.trackName ?? ""),
),
//Group
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
// "Overhaul Media Group",
podcastInfo.artistName,
style: TextStyle(
fontSize: 14,
color: Color(0xFF969696),
fontFamily: "Product Sans",
),
),
),
model.loading
? Container(
height: 150,
child: Center(
child: SpinKitWave(
color: Color(0xffe7ad29),
type: SpinKitWaveType.center),
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Subscribe button
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
RaisedButton(
color: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
color: Color(0xffe7ad29)),
),
onPressed: model.isSubscribed
? () {
model.unsubPodcast();
}
: () {
model.subscribePodcast();
},
child: Text(
model.isSubscribed
? "UNSUBSCRIBE"
: "SUBSCRIBE",
style: TextStyle(
color: Colors.white,
),
),
),
///
///Share Button
RaisedButton(
color: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
color: Color(0xffe7ad29)),
),
onPressed: () {
model.sharePodcast();
},
child: Text(
"SHARE",
style: TextStyle(
color: Colors.white,
),
),
),
],
),
),
//Body text
Padding(
padding: const EdgeInsets.only(
left: 8, right: 8, bottom: 8),
child: Container(
child: Text(
// "Podcast Overhaul was created to provide you with helpful hints, tips, & strategies you need to help you get the most out of your podcast every episode...ALL in 10 minutes or less.",
model.podcast.description ?? "",
style: TextStyle(
color: Color(0xFFB0ABAB),
fontSize: 15,
fontFamily: "Sogoe UI",
),
),
),
),
///Season
Container(
decoration: BoxDecoration(
color: Color(0xffe7ad29),
borderRadius: BorderRadius.only(
topRight: Radius.circular(20),
topLeft: Radius.circular(20)),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
SizedBox(
height:
MediaQuery.of(context).size.height *
0.02,
),
Container(
width:
MediaQuery.of(context).size.width,
padding: EdgeInsets.only(bottom: 6),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color(0xFF707070),
),
),
),
child: mainHeading("EPISODES"),
),
Column(
children: model.podcast.episodes
.map<Widget>(
(e) => Container(
width: MediaQuery.of(context)
.size
.width,
padding: EdgeInsets.only(
bottom: 6, top: 10),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color(0xFF707070),
),
),
),
child: GestureDetector(
onTap: () {
print('test');
print(podcastInfo);
print('debug');
print(e);
Navigator.pushNamed(
context,
'player',
arguments: new PlayerInfo(
item: podcastInfo,
episode: e,
),
);
},
child: mainHeading(e.title),
),
),
)
.toList(),
),
],
),
),
)
],
),
],
),
)
],
),
You can see in the screenshot its showing white empty space I try to wrap my yellow container in expanded but it's not working. I think I can sole by height but then it will scroll or some related issue will come.
Container(
height: MediaQuery.of(context).size.height,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Header Image
Container(
width: double.infinity,
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(podcastInfo.artworkUrl600),
fit: BoxFit.fill,
),
),
child: Container(
margin: EdgeInsets.only(left: 10, top: 15),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(),
Spacer(),
],
),
),
),
You can wrap column in in container and give a height using media query. On overflow you can use SinglechildScrollView also.
Related
i got overflow when textformfield opens in showModalBottomSheet, i tried to wrap my first column widget with SingleChildScrollView but it gives me a hidden modalBottomSheet same as ListView i tried to wrap it but all the data disappeared (empty white sheet)
showModalBottomSheet(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
context: context,
builder: (context) {
return Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Expanded(
child: Column(
children: [
Row(
children: [
CircleAvatar(
radius: 22,
backgroundImage: NetworkImage(
'${SocialCubit.get(context).userModel!.image}'),
),
SizedBox(
width: 15,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10),
color: Colors.grey[350],
),
child: Padding(
padding:
const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'${SocialCubit.get(context).userModel!.name}',
style: TextStyle(
fontSize: 15,
fontWeight:
FontWeight
.bold),
),
SizedBox(
width: 7,
),
Text(
'2 minutes ago',
style: TextStyle(
fontSize: 11),
),
],
),
SizedBox(
height: 5,
),
Text(
'whats up broo i need to ask you something'),
],
),
),
),
],
),
if (model.postImage != '')
Padding(
padding: const EdgeInsetsDirectional.only(top: 15,start: 67),
child: Container(
height: 140,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
image: NetworkImage('${model.postImage}'),
fit: BoxFit.cover,
),
)),
),
],
),
),
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context)
.viewInsets
.bottom),
child: Row(
children: [
CircleAvatar(
radius: 18,
backgroundImage: NetworkImage(
'${SocialCubit.get(context).userModel!.image}'),
),
SizedBox(
width: 15,
),
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(30),
color: Colors.grey[300],
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: TextFormField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Write your comment ...'
),
),
),
),
),
IconButton(
onPressed: () {},
icon: Icon(IconBroken.Send)),
],
),
),
],
),
);
});
my problem (overflow)
i tried to wrap the column with ListView but i got no data as shown
this one with SingleChildScrollView,
If you like to use SingleChildScrollView, remove Expanded from Column widget, You can think like, SingleChildScrollVew provides infinite height and Exapanded widget is trying to get infinite and this cause issue.
You can follow this way
showModalBottomSheet(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
context: context,
builder: (context) {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Column(
children: [
Row(
children: [
// CircleAvatar(
// radius: 22,
// backgroundImage: NetworkImage(
// '${SocialCubit.get(context).userModel!.image}'),
// ),
SizedBox(
width: 15,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey[350],
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
// Text(
// '${SocialCubit.get(context).userModel!.name}',
// style: TextStyle(
// fontSize: 15,
// fontWeight:
// FontWeight
// .bold),
// ),
SizedBox(
width: 7,
),
Text(
'2 minutes ago',
style: TextStyle(fontSize: 11),
),
],
),
SizedBox(
height: 5,
),
Text(
'whats up broo i need to ask you something'),
],
),
),
),
],
),
],
),
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Row(
children: [
SizedBox(
width: 15,
),
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.grey[300],
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20),
child: TextFormField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Write your comment ...'),
),
),
),
),
],
),
),
],
),
),
);
});
Also there is DraggableScrollableSheet you may like it.
you can directly install pub library to use modal
https://pub.dev/packages/modal_bottom_sheet/install
How can I create button like below,
Try below code hope its helpful to you. used Stack widget here for that
Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: circleRadius / 2.0),
child: Container(
height: 200,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
color: Colors.white,
margin: EdgeInsets.all(
16,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 2,
height: 2,
decoration: ShapeDecoration(
shape: CircleBorder(),
color: Colors.transparent,
),
),
],
),
),
),
),
Container(
width: 100,
height: 40,
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(),
color: Colors.transparent,
),
child: Padding(
padding: EdgeInsets.all(1),
child: DecoratedBox(
child: Center(
child: Text(
'Profile',
style:TextStyle(color: Colors.white,),
textAlign: TextAlign.center,
),
),
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
color: Colors.blue,
),
),
),
)
],
),
Your Result screen->
Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(20))),
child: TextButton(
child: Text(
"Profile",
style: TextStyle(color: Colors.white),
),
onPressed: () {},
),
),
you can use following code sample...change height according to your need...or use mediaquery for better result:
Container(
height: 275,
child: Stack(
children: [
Container(//container with background color
height: 250,
child: //other widgets
),
Positioned(
bottom: 0,
child: //button here
),
],
),
),
How to achieve the following design in Flutter?
I wanted to implement
but I get this result
I have three Containers. Main container inside that two more container placed horizontally And I want to position Icon to the top right corner of the main Container.
Below is my code
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(
top: widget.index != 0 ? 18 : 0,
),
child: Row(children: <Widget>[
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Container(
width: 354,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
offset: Offset(0.0, 1.0), //(x,y)
blurRadius: 3.0,
),
],
border: Border.all(
color: Colors.white,
width: 1,
)),
padding: EdgeInsets.only(left: 3),
child: Row(
children: <Widget>[
Container(
height: 85.0,
width: 85.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
color: Colors.grey.shade50,
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Image(
image: AssetImage(
'${widget.restaurantListModelObj.restImage}'),
),
),
),
SizedBox(
width: 10.0,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(10),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.restaurantListModelObj.restaurantName,'),
),
Icon(Icons.bookmark_border_outlined,
color: Colors.orange, size: 17),// this
icon i wanted to top right corner of main container.
],
),
),
Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.restaurantListModelObj.foodCategory,
),
SizedBox(
width: 30,
),
Text(
'${widget.restaurantListModelObj.distance} Km',
),
],
),
),
Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(Icons.star, color: Colors.orange, size: 17),
Text(
'${widget.restaurantListModelObj.restReview}',
),
SizedBox(
width: 35,
),
Icon(Icons.watch_later_outlined, size: 17),
Text(
'${widget.restaurantListModelObj.distanceFromLocation} Mins',
),
SizedBox(
width: 35,
),
Text(
widget.restaurantListModelObj.restStatus,
),
],
),
),
],
)
],
),
),
),
),
]),
);
}
I don't understand how to do this.
There are many ways for doing that. If you want to have full control over the exact location of your widget. wrap the container in a Stack widget. Then put your icon in another container, and put it in the same Stack widget.
Once you do that, you can control the exact location of your widget using the Align widget. Here's an example:
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(
top: 18,
),
child: Row(children: <Widget>[
Stack(
children: [
Container(
width: 354,
height: 400,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1,
)),
padding: EdgeInsets.only(left: 3),
),
Container(
width: 354,
height: 400,
child: Align(
alignment: Alignment(1, -1),
//Alignment(1, -1) place the image at the top & far left.
//Alignment (0, 0) is the center of the container
//You can change the value of x and y to any number between -1 and 1
child: Icon(Icons.bookmark_border_outlined,
color: Colors.orange, size: 17),
),
),
],
),
]),
);
}
Wrap restaurant name with Expended widget
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
"Restaurant Name",
),
),
Icon(Icons.bookmark_border_outlined),
],
);
There are many ways to achieve this. I have done as follows. Design your items as per desired. I had only worked on layout placement.
Container(
padding: EdgeInsets.all(10),
height: 110,
width: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
offset: Offset(0.0, 1.0), //(x,y)
blurRadius: 3.0,
),
],
border: Border.all(
color: Colors.white,
width: 1,
)),
padding: EdgeInsets.only(left: 3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
height: 85.0,
width: 85.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
color: Colors.grey.shade50,
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Image(
image: NetworkImage(
'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png',
),
fit: BoxFit.contain,
// image: AssetImage(
// '${widget.restaurantListModelObj.restImage}'),
// ),
),
),
// ),
),
SizedBox(
width: 10.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Text("Restaurant Name",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
)),
],
),
SizedBox(height: 5),
Row(children: [
Text("Fast Food"),
SizedBox(width: 15),
Text("21 Km"),
]),
SizedBox(height: 5),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(children: [
Icon(Icons.star),
SizedBox(width: 5),
Text("4.3")
]),
SizedBox(width: 5),
Row(children: [
Icon(Icons.timer),
SizedBox(width: 5),
Text("56 mins")
]),
SizedBox(width: 5),
Row(children: [
Icon(Icons.calendar_today),
SizedBox(width: 5),
Text("OPen")
]),
])
]),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.topRight,
child: Icon(Icons.bookmark, color: Colors.orange)),
)
]),
))),
I am running into issues pushing down the listview out of view of the draggablescrollablesheet (sheet) while still being able to scroll the sheet. So in simpler words I do not want the blue container to show up when the sheet is at the bottom.
I have tried to edit the height of the listview container and that makes it go offscreen therefore unscrollable.
I have also tried wrapping the sheet in a singlechildscrollview with no luck. I am trying to avoid using a button at all possible costs!
import 'package:flutter/material.dart';
import 'package:photosgroup2/chat/message_model.dart';
import 'package:photosgroup2/chat/user_model.dart';
class FeedTest extends StatefulWidget {
FeedTest({Key key}) : super(key: key);
#override
_FeedTest createState() => _FeedTest();
}
class _FeedTest extends State<FeedTest> {
_buildMessage(
Message message,
User user,
) {
//Reply reply){
String time= message.time;
return Container(
// color: Colors.yellow,
child: Padding(
padding: EdgeInsets.only(left: 0), //5
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 5 ,top: 3.5), //10
child: new CircleAvatar(
radius: (17.5),
backgroundImage: AssetImage(
user.profilePic,
),
),
),
SizedBox(
width: 5,
),
Container(
//width: MediaQuery.of(context).size.width,
// width: 300,
child: Material(
color:Color(0x00000000) , //TRANSPARENT
//color: const Color(0xf2ffffff),
///Color(0xe6ffffff) // ! REVISIT Change color of boxes???
/*borderRadius: BorderRadius.only(
topRight: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
bottomLeft: Radius.circular(16.0),
),*/
child: Padding(
padding: EdgeInsets.only(
left: 10.0), //Revisit
child: Column(
//mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min,
//crossAxis
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 5,
),
Text(
user.name,
style: TextStyle(
fontFamily: 'Lato-Bold',
fontSize: 13 ,
color: const Color(0xd9343f4b),
),
textAlign: TextAlign.left,
),
SizedBox(width: 8),
Padding(
padding: const EdgeInsets.only(left:8.0),
child: Text(
'$time hours ago',
style: TextStyle(
fontFamily: 'Lato',
fontSize: 12 ,
color: const Color(0xff5a6978),
),
textAlign: TextAlign.left,
),
),
SizedBox(
height: 5,
),
//SizedBox(height: 10,),//if(message.imageUrl!='') {
//hasReplies(message, user, reply)
//},
//}
],
),
),
),
),
],
),
SizedBox(height:5),
Container(
//color:Colors.blue,
//: EdgeInsets.only(right:10
//right: 10 * SizeConfig.widthRatio,
//),
child: Container(
//color: Colors.green,
margin: EdgeInsets.only(left:5,right:15),
child: Text(
message.text,
style: TextStyle(
fontFamily: 'Lato',
fontSize: 13 ,
color: const Color(0xff5a6978),
height: 1.5384615384615385
),
textAlign: TextAlign.left,
),
),
),
SizedBox(//color:Colors.amber,
height:15),
Transform.translate(
offset: Offset(-6,0),
child: Container(
width: 350.0,
height: 0.5,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.0),
color: const Color(0x40343f4b),
),
),
),
SizedBox(//color:Colors.amber,
height:5),
],
),
),
);
}
#override
Widget build(BuildContext context) {
// visibility of reply button in top right corner
return Scaffold(
backgroundColor: const Color(0xfffafafa),
body: SafeArea(
bottom: false,
top: false,
child: //Column(
//mainAxisAlignment: MainAxisAlignment.spaceAround,
//children: <Widget>[
Stack(
children: <Widget>[
DraggableScrollableSheet(
initialChildSize: 0.068,
minChildSize: 0.068,
maxChildSize: 0.71,
builder: (context, scrollController) {
return Container(
//padding: EdgeInsets.symmetric(horizontal: 20),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32),
topRight: Radius.circular(32),
),
child: Container(
width: 375, //screen width
height: 812 * 0.71, //screen height *
color: Color(0xffdfdfdf),
),
),
),
Stack(
children: [
Padding(
padding: const EdgeInsets.only(left: 10, top: 20.0),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(27.5),
topRight: Radius.circular(27.5),
),
child: Container(
//margin: EdgeInsets.only(),
width:340,
//height: 515,
color: Colors.yellow,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(27.5),
topRight: Radius.circular(27.5),),
child: Container(
// padding: EdgeInsets.only(top:40),
color: Colors.blue,
child: ListView.builder(
//reverse: true,
controller: scrollController,
itemCount: comments.length,
itemBuilder: (BuildContext context, int index) {
final User messenger = comments[index].sender;
final Message message = comments[index];
//final Reply reply = replies[index];
return Column(children: <Widget>[
_buildMessage(
message,
messenger,
), //reply),
SizedBox(
height: 8,
) // !COME BACK TO SPACE BETWEEN
]);
},
),
),
),
),),
),
],
),
Stack(
children: <Widget>[
//67
Padding(
padding: EdgeInsets.only(left: 141, top: 6),
child: SizedBox(
width: 93.0,
height: 29.0,
child: Stack(
children: <Widget>[
SizedBox(
width: 93.0,
height: 29.0,
child: Stack(
children: <Widget>[
// Adobe XD layer: 'Rectangle' (shape)
Container(
width: 93,
height: 29.0,
child: Padding(
padding: EdgeInsets.only(
left: 1, top: 6),
child: Text(
'Place Holder',
style: TextStyle(
fontFamily: 'Lato',
fontSize: 12,
color: const Color(0xffffffff),
),
textAlign: TextAlign.center,
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27.5),
color: const Color(0xf2343f4b),
),
),
],
),
),
],
),
),
),
],
),
],
),
);
},
),
],
),
// ],
//),
),
);
}
}
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
],
),
);