ModelViewer in ListView - Flutter - flutter

I have ListView which has ModelViewer in it. ModelViewer initially makes it possible to twist the object in different directions. But inside ListView the object does not rotate. Does anyone know how to fix this?
ListView(children: [
Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
height: 500,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: ModelViewer(
backgroundColor: Colors.grey[50],
src: 'assets/totoro.glb',
alt: "3D-модель аниме персонажа Totoro",
autoPlay: true,
autoRotate: false,
cameraControls: true,
),
),
),
const SizedBox(height: 10.0),
Container(
//height: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: Colors.grey[50],
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10)
]),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Align(
alignment: Alignment.topLeft,
child: Text(
'Totoro is a giant furry beast that roars through the forest and makes strange sounds like "to-to-ro". In a word, Totoro is a Japanese lamb.',
style: GoogleFonts.roboto(
fontSize: 20,
color: Colors.black87.withOpacity(0.7),
fontWeight: FontWeight.w700)),
),
),
)
],
),
),
]),

Related

showModalBottomSheet bottom overflow

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

Placing button at the bottom of container in flutter

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 align icon to the top right corner of the Container

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)),
)
]),
))),

Flutter give container remaining height

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.

Card size not being adjusted when wrapped in a container

In my flutter app I have a GridView in which I list cards. In the cards I want to have an image and some text. I am trying to do this as follows:
import 'package:flutter/material.dart';
class Home extends StatefulWidget{
#override
State<StatefulWidget> createState() {
return HomeState();
}
}
class HomeState extends State<Home>{
#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Container(
child: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.green,
Colors.teal,
]
)
),
),
Padding(
padding: const EdgeInsets.only(top: 65),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white60, width: 2.0)
),
padding: EdgeInsets.all(8),
child: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(Icons.restaurant, size: 120,),
),
),
]
),
SizedBox(
height: 8,
),
Text(
"Genesis Technologies",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
color: Colors.white
),
),
SizedBox(
height: 6,
),
Text(
"Please take the following precautions",
style: TextStyle(
fontSize: 16,
color: Colors.white70
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 350),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
)
),
),
Container(
margin: EdgeInsets.only(top: 250),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)
)
),
child: Padding(
padding: EdgeInsets.all(0),
child: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
children: <Widget>[
Container(
height: 200,
width: 100,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(Icons.restaurant, size: 120,),
Text(
"Cover your mouth and nose when yous sneeze or cough",
style: TextStyle(
fontWeight: FontWeight.bold
),
),
],
),
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(Icons.restaurant, size: 120,),
Text(
"Avoid touching your face with unwashed hands",
style: TextStyle(
fontWeight: FontWeight.bold
),
),
],
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(Icons.restaurant, size: 120,),
Text(
"Stay home if you don't need to get out for critical matters",
style: TextStyle(
fontWeight: FontWeight.bold
),
),
],
),
),
),
],
)
),
),
],
),
),
),
);
}
}
And this renders the list of cards fine. My problem is that the cards bottom is being overflowed. I wrap the card in a container to fix this which looks like the follows:
Container(
height: 200,
width: 100,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(Icons.restaurant, size: 120,),
Text(
"Some text here",
style: TextStyle(
fontWeight: FontWeight.bold
),
),
],
),
),
),
),
I don't understand why this is happening. Any help would be appreciated. Thanks.
ok... I usual don't do that but I had to rework the whole structure because most of the things didn't make any sense. Now I don't really understand.. Why do you want cards to increase size to not overflow.. Did you mean decrease size? The cards in your grid view will be always the same because you use grid view. You have set crossAxisCount to 2 so 2 items in x axis and square.. If you add more, then on smaller screen they will be accessible by scrolling and will not overflow. I have set position of the container where you have all your cards from the top to 1/3 of the screen height which perhaps is better then hardcoding it to fixed size as you had. Try it and let me know if you need to adjust it in any other way.
UPDATE
Scaffold(
body: Column(children: [
Flexible(
flex: 2,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Colors.green,
Colors.teal,
])),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
flex: 1,
child: FractionallySizedBox(
heightFactor: 0.5,
child: Container(
width: 100,
decoration: BoxDecoration(
shape: BoxShape.circle,
border:
Border.all(color: Colors.white60, width: 2.0)),
padding: EdgeInsets.all(8),
child: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(
Icons.restaurant,
),
),
),
),
),
SizedBox(
height: 8,
),
Text(
"Genesis Technologies",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
color: Colors.white),
),
SizedBox(
height: 6,
),
Text(
"Please take the following precautions",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.white70),
),
],
),
),
),
Flexible(
flex: 3,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Colors.green,
Colors.teal,
])),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30))),
child: Padding(
padding: EdgeInsets.all(0),
child: GridView(
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
children: <Widget>[
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
Icons.restaurant,
size: 120,
),
Text(
"Cover your mouth and nose when yous sneeze or cough",
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
Icons.restaurant,
size: 120,
),
Text(
"Avoid touching your face with unwashed hands",
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 10,
child: Container(
margin: EdgeInsets.all(4),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
Icons.restaurant,
size: 120,
),
Text(
"Stay home if you don't need to get out for critical matters",
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
),
],
)),
),
),
),
]),
);