Gradient Background on Flutter AppBar - flutter

How do I set the backgroundColor of theAppBar to a gradient?

I don't believe you can pass a gradient to an AppBar as it expects a Color rather than a gradient.
You can, however, create your own widget that mimics an AppBar except by using a gradient.
Take a look at this example that I've pieced together from the Planets-Flutter tutorial along with the code below it.
import "package:flutter/material.dart";
class Page extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Column(children : <Widget>[GradientAppBar("Custom Gradient App Bar"), Container()],);
}
}
class GradientAppBar extends StatelessWidget {
final String title;
final double barHeight = 50.0;
GradientAppBar(this.title);
#override
Widget build(BuildContext context) {
final double statusbarHeight = MediaQuery
.of(context)
.padding
.top;
return new Container(
padding: EdgeInsets.only(top: statusbarHeight),
height: statusbarHeight + barHeight,
child: Center(
child: Text(
title,
style: TextStyle(fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.bold),
),
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.red, Colors.blue],
begin: const FractionalOffset(0.0, 0.0),
end: const FractionalOffset(0.5, 0.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp
),
),
);
}
}
Hope this helps. Let me know if you have any questions.

This should work flawlessly:
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[Colors.black, Colors.blue]),
),
),
),
);

AppBar does not have that feature by default. But you can make an AppBar like widget which will have a gradient background as follow:
Widget build(BuildContext context) {
return new Scaffold(
appBar: new PreferredSize(
child: new Container(
padding: new EdgeInsets.only(
top: MediaQuery.of(context).padding.top
),
child: new Padding(
padding: const EdgeInsets.only(
left: 30.0,
top: 20.0,
bottom: 20.0
),
child: new Text(
'Arnold Parge',
style: new TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
color: Colors.white
),
),
),
decoration: new BoxDecoration(
gradient: new LinearGradient(
colors: [
Colors.red,
Colors.yellow
]
),
boxShadow: [
new BoxShadow(
color: Colors.grey[500],
blurRadius: 20.0,
spreadRadius: 1.0,
)
]
),
),
preferredSize: new Size(
MediaQuery.of(context).size.width,
150.0
),
),
body: new Center(
child: new Text('Hello'),
),
);
}
Here boxShadow will give elevated feel.

Just wrap AppBar in the Widgets Material > Container with grandient, so you can keep the original AppBar's attributes. here is my implementation with necesary attributes.
import 'package:flutter/material.dart';
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
const CustomAppBar({
Key? key,
this.title,
this.leading,
this.actions,
this.elevation = 2.0,
}) : super(key: key);
final Widget? title;
final Widget? leading;
final double elevation;
final List<Widget>? actions;
#override
Widget build(BuildContext context) {
return Material(
elevation: elevation,
child: Container(
decoration: const BoxDecoration(
gradient: RadialGradient(
radius: 2.5,
stops: [
0.0,
0.27,
1.0,
],
colors: [
Color(0XFFB71731),
Color(0XFFB71731),
Color(0XFFA5004E),
],
),
),
child: AppBar(
centerTitle: true,
leading: leading,
elevation: 0.0,
title: title,
backgroundColor: Colors.transparent,
actions: actions,
),
),
);
}
#override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}
then, just use it wherever you want
class MyPage extends StatelessWidget {
const MyPage ({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CustomAppBar(),
body: Center(child:Text("My App gradient"),
);
}
}

You can decorate using flexibleSpace
appBar: AppBar(
centerTitle: true,
title: Text(widget.title),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: <Color>[
Colors.red,
Colors.blue
])
),
),
),

#Riki137 answer work like charm.
Here's another approach if anyone wanna give it a try.
_appBar = AppBar();
return PreferredSize(
child: ShaderMask(
child: _appBar,
shaderCallback: (rect) {
return ui.Gradient.linear(rect.centerLeft, rect.centerRight,
[Colors.black, Colors.grey]);
}),
preferredSize: _appBar.preferredSize,
);

Set the background and shadow colors to Colors.transparent in a standard AppBar, then wrap a Container(...) around it, using BoxDecoration(gradient: LinearGradient(...)), and bob is, of course, your uncle.
import 'package:flutter/material.dart';
import 'package:pga_app/core/colors.dart';
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
const CustomAppBar({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
TextTheme thm = Theme.of(context).textTheme;
return Container(
child: AppBar(
automaticallyImplyLeading: true,
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
title: const Text(
"My Cool App",
textAlign: TextAlign.center,
),
actions: [
TextButton(
child: const Icon(Icons.menu, size: 36, color: COLOR_BUTTON_WHITE),
onPressed: () {},
),
],
),
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.0, 1.0],
colors: [
COLOR_PANEL_DARK_BLUE,
COLOR_PANEL_BLUE,
],
),
),
);
}
#override
Size get preferredSize => Size(900, 56);
}
Forgive my use of undefined (in this post) constants; this was pulled from a production app and the names were changed to protect the innocent.

Related

A little line appears at the bottom of AppBar when setting toolbarHeight property with a value

I try to set Scaffold AppBar with the top widget of the body to the same gradient color. And AppBar height with a specific size uses the toolbarHeight property. But when I do it, an unexpected line appears between AppBar and the top widget of the body. I tried searching on the internet and found a solution to set backgroundColor property with the same color of flexibleSpace container widget, the problem is solved. But I can't use this solution, because I use gradient color for the background.
Here is the code:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.amber,
),
home: const CloneMyHomePage(),
);
}
}
const LinearGradient appBarGradient = LinearGradient(
colors: [
Color.fromARGB(255, 29, 201, 192),
Color.fromARGB(255, 125, 221, 216),
],
stops: [0.5, 1.0],
);
class CloneMyHomePage extends StatelessWidget {
const CloneMyHomePage({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// backgroundColor: Color.fromARGB(255, 125, 221, 216),
toolbarHeight: 100.0,
bottomOpacity: 0.0,
elevation: 0.0,
flexibleSpace: Container(
decoration: const BoxDecoration(
// color: Color.fromARGB(255, 125, 221, 216),
gradient: appBarGradient,
),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
alignment: Alignment.topLeft,
child: Text(
"My title",
style: TextStyle(color: Colors.black),
),
),
Container(
padding: const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: const [
Padding(
padding: EdgeInsets.only(right: 15),
child: Icon(Icons.notifications_outlined),
),
Icon(Icons.search),
],
),
),
],
),
),
body: Column(
children: [BelowAppBar()],
),
);
}
}
class BelowAppBar extends StatelessWidget {
const BelowAppBar({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
// final user = Provider.of<UserProvider>(context).user;
return Container(
decoration: const BoxDecoration(
// color: Color.fromARGB(255, 125, 221, 216),
gradient: appBarGradient,
),
padding: const EdgeInsets.only(
left: 10,
right: 10,
bottom: 10,
),
child: Row(
children: [
RichText(
text: TextSpan(
text: 'Hello, ',
style: const TextStyle(
fontSize: 22,
color: Colors.black,
),
children: [
TextSpan(
text: "Dung",
style: const TextStyle(
fontSize: 22,
color: Colors.black,
fontWeight: FontWeight.w600,
),
),
],
),
),
],
),
);
}
}
Here is the image (arrow points to the little line):
The image shows an unexpected line between AppBar and first widget of the body

Stack with circular progress bar and elevated button in flutter

I'm wanted to achieve the following UI in the screenshot and achieved by the below code on two different phones. But the same is not working on many other devices. Is there a way to handle the size of CircularProgressIndicator(currently I'm using Transform.scale() which is not giving me generic result) so that it fits around the sibling container inside the stack?
Edit:
The reason for using CircularProgressIndicator is to show progress.
Widget build(BuildContext context) {
final mediaq = MediaQuery.of(context).size;
return Stack(alignment: Alignment.center, children: [
Transform.scale(
scale: mediaq.width <= 360 ? 2.35 : 2.70,
child: const CircularProgressIndicator(
backgroundColor: Colors.white,
color: Colors.orange,
strokeWidth: .75,
value: 1,
),
),
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [Colors.red, Colors.orange],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
fixedSize: Size(mediaq.width * .24, mediaq.height * .12),
shape: const CircleBorder(side: BorderSide.none),
),
onPressed: () {},
child: const Text("child")),
),
]);
}
Re wrote your code and here is my output
Transform.scale(
scale: mediaq.width> 375 ? 3.10 : 2.35,
child: const CircularProgressIndicator(
backgroundColor: Colors.white,
color: Colors.white,
strokeWidth: .75,
value: 1,
),
),
Output:
Iphone 12 Pro Max (W:428 , H:926)
Iphone SE (Second Generation) (W:375, H: 667)
Also you can try this package for responsive ui.
You can use flutter_screenutil package to make your UI more responsive, instead of MediaQuery.
I have done your screen using flutter_screenutil package.
Please try this out. I assumed the heights, widths, and radius. You can modify these as per your requirement. I have also attached the UI I got.
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(375, 667),
minTextAdapt: true,
builder: () {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const ButtonTest(),
);
});
}
}
class ButtonTest extends StatefulWidget {
const ButtonTest({Key? key}) : super(key: key);
#override
_ButtonTestState createState() => _ButtonTestState();
}
class _ButtonTestState extends State<ButtonTest> {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Container(
height: 94.h, // You can change here
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.white,
),
),
child: Padding(
padding: EdgeInsets.all(
2.0.w, // You can change here
),
child: GestureDetector(
onTap: () {
print("Button Pressed");
},
child: Container(
height: 92.h, // You can change here
width: 92.h, // You can change here
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [
Colors.red,
Colors.orange,
],
),
),
child: const Center(
child: Text(
'child',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
)),
),
),
),
),
),
);
}
}

Flutter - hover color of list tile not showing when sidenav gradient color is set (MacOS app)

I am trying to add a side navigation bar with gradient color and this works fine. However, I also set the hover color for list tile (Dashboard) in red but it's not showing when I hover. I am guessing that the sidenav's background color is covering up the color of list tile when hovering. Any ideas on how to fix it? Thanks!
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
pageTransitionsTheme: PageTransitionsTheme(builders: {
TargetPlatform.iOS: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
}),
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final navigatorKey = GlobalKey<NavigatorState>();
#override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
Drawer(
elevation: 0,
child: Container(
decoration: new BoxDecoration(
border: Border(
right: BorderSide(width: 0.0, color: Colors.transparent),
left: BorderSide(width: 0.0, color: Colors.transparent),
),
gradient: new LinearGradient(
colors: [
const Color(0xFFBE9CF9),
const Color(0xFF5378EE),
],
begin: const FractionalOffset(0.0, 0.2),
end: const FractionalOffset(1.0, 1.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp),
),
child: ListView(
physics: NeverScrollableScrollPhysics(),
children: <Widget>[
Container(
width: double.infinity,
child: ListTile(
hoverColor: Colors.red,
enabled: true,
title: Padding(
padding: const EdgeInsets.all(0.0),
child: Row(
children: [
Icon(
Icons.home,
color: Colors.white,
size: 22.0,
),
SizedBox(width: 8),
Text(
"Dashboard",
style: TextStyle(color: Colors.white),
),
],
),
),
onTap: () {},
),
),
],
),
),
),
Expanded(
child: Navigator(
key: navigatorKey,
initialRoute: '/',
onGenerateRoute: (settings) {
return MaterialPageRoute(
builder: (context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.black,
elevation: 0,
iconTheme: IconThemeData(color: Colors.black),
title: Text("Title",
style: TextStyle(color: Colors.black)),
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(""),
),
),
);
},
settings: settings);
},
),
),
],
);
}
}
Wrap your ListTile with a Material widget:
Material(
type: MaterialType.transparency,
child: ListTile(...),
)
The way the hoverColor works - is render the hover on the first Material parent that it finds. The first one in your tree is the App itself and the gradient overlaps it. So you need to wrap your ListTile in another Material widget so it's the first one before the gradient.
That's a known behavior of the Flutter framework (search for Flutter Inkwell decoration problem which is similar)
Another problem that can cause this (talking about the general case where hovering the mouse over the ListTile does not react at all) is because there is no onTap: attribute passed.

How do I make a Container Transparent outside of his rounded corners?

I have a container wrapped in Dismissible, both the container and dismissible background have their corners cut.
My problem is that even though the corner of the container on top is cut the space that would have been the corner is white instead of transparent.
Here's What I have vs What I want (made on paint)
I tried throwing Colors.transparent around but had no success.
Here is the full code:
import 'package:flutter/material.dart';
class Test extends StatefulWidget {
#override
_TestState createState() => _TestState();
}
class _TestState extends State<Test> {
static const Radius _borderRadius = const Radius.circular(65.0);
#override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Dismissible(
key: ValueKey("hmm"),
background: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.red, width: 3),
borderRadius: BorderRadius.all(_borderRadius),
color: Colors.white,
),
),
secondaryBackground: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.red, width: 3),
borderRadius: BorderRadius.all(_borderRadius),
color: Colors.white,
),
),
child: Container(
width: 300,
height: 200,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(_borderRadius),
gradient: LinearGradient(
colors: [Colors.blue, Colors.pink],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
)),
),
)),
);
}
}
Found here
The problem is the clipping behavior in dismissible.dart. I've managed to solve the problem by editing the Dismissible class itself. In lines 559 - 573, you will find an if-statement that looks like this:
if (background != null) {
content = Stack(children: <Widget>[
if (!_moveAnimation.isDismissed)
Positioned.fill(
child: ClipRect(
clipper: _DismissibleClipper(
axis: _directionIsXAxis ? Axis.horizontal : Axis.vertical,
moveAnimation: _moveAnimation,
),
child: background,
),
),
content,
]);
}
If you just comment out the clipper-property in ClipRect, the background will be transparent and you won't lose the collapsing animation.
You can fix this by using moving your background out of your Dismissible:
Full source code:
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
home: HomePage(),
),
);
}
class HomePage extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Scaffold(
body: Test(),
);
}
}
class Test extends StatefulWidget {
#override
_TestState createState() => _TestState();
}
class _TestState extends State<Test> {
static const Radius _borderRadius = const Radius.circular(65.0);
#override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Center(
child: Container(
width: 300,
height: 200,
decoration: BoxDecoration(
border: Border.all(color: Colors.red, width: 3),
borderRadius: BorderRadius.all(_borderRadius),
color: Colors.white,
),
),
),
Dismissible(
key: ValueKey("hmm"),
child: Center(
child: Container(
width: 300,
height: 200,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(_borderRadius),
gradient: LinearGradient(
colors: [Colors.blue, Colors.pink],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
),
),
],
),
);
}
}

In the bottom of my app there is a white space Flutter

import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:url_launcher/url_launcher.dart';
class HomeScreen extends StatefulWidget {
#override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
int _currentIndex = 0;
List cardList = [Item1(), Item2(), Item3(), Item4()];
List<T> map<T>(List list, Function handler) {
List<T> result = [];
for (var i = 0; i < list.length; i++) {
result.add(handler(i, list[i]));
}
return result;
}
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Card Carousel App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: SafeArea(
child: Scaffold(
resizeToAvoidBottomPadding: false,
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image(
image: AssetImage('assets/liberta.jpeg'),
width: 120,
),
Text(
'Libertà&Ricchezza',
style: TextStyle(color: Colors.black),
)
],
),
backgroundColor: Colors.white,
),
body: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
image: DecorationImage(
image: AssetImage('assets/background.jpeg'),
fit: BoxFit.cover,
)
),
child: Column(
children: <Widget>[
SizedBox(
height: 10,
),
CarouselSlider(
options: CarouselOptions(
height: 240.0,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.fastOutSlowIn,
pauseAutoPlayOnTouch: true,
aspectRatio: 2.0,
onPageChanged: (index, reason) {
setState(() {
_currentIndex = index;
});
},
),
items: cardList.map((card) {
return Builder(builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.30,
width: MediaQuery.of(context).size.width,
child: Card(
color: Colors.blueAccent,
child: card,
),
);
});
}).toList(),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: map<Widget>(cardList, (index, url) {
return Container(
width: 10.0,
height: 10.0,
margin:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _currentIndex == index
? Colors.white
: Colors.grey,
),
);
}),
),
SizedBox(
height: 20,
),
Row(
children: [
Expanded(
child: Container(
height: 85,
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xff024f9c),
),
child: Center(
child: Text(
"L&R PER LA PERSONA",
style: TextStyle(
color: Colors.white,
fontSize:20,
fontWeight: FontWeight.bold
),
textAlign: TextAlign.center,
),
),
)),
],
),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
Navigator.pushNamed(context, '/persona');
});
},
child: Container(
height: 85,
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xff9c0202),
),
child: Center(
child: Text(
"L&R PER L'AZIENDA",
style: TextStyle(
color: Colors.white,
fontSize:20,
fontWeight: FontWeight.bold
),
textAlign: TextAlign.center,
),
),
)),
),
],
)
],
),
),
),
),
));
}
}
class Item1 extends StatelessWidget {
const Item1({Key key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
child: InkWell(
child: Image(
image: AssetImage('assets/mandela.jpeg'),
fit: BoxFit.cover,
),
onTap: () => launch('https://www.instagram.com/libertaericchezza/'),
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
0.3,
1
],
colors: [
Color(0xffff4000),
Color(0xffffcc66),
]),
),
);
}
}
class Item2 extends StatelessWidget {
const Item2({Key key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
child:InkWell(
child: Image(
image: AssetImage('assets/astronauta.jpeg'),
fit: BoxFit.cover,
),
onTap: () => launch('https://www.instagram.com/libertaericchezza/'),
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
0.3,
1
],
colors: [
Color(0xffff4000),
Color(0xffffcc66),
]),
),
);
}
}
class Item3 extends StatelessWidget {
const Item3({Key key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
child:InkWell(
child: Image(
image: AssetImage('assets/farfalle.jpeg'),
fit: BoxFit.cover,
),
onTap: () => launch('https://www.instagram.com/libertaericchezza/'),
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
0.3,
1
],
colors: [
Color(0xffff4000),
Color(0xffffcc66),
]),
),
);
}
}
class Item4 extends StatelessWidget {
const Item4({Key key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
child: InkWell(
child: Image(
image: AssetImage('assets/car.jpeg'),
fit: BoxFit.cover,
),
onTap: () => launch('https://www.instagram.com/libertaericchezza/'),
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
0.3,
1
],
colors: [
Color(0xffff4000),
Color(0xffffcc66),
]),
),
);
}
}
I have insert a background image but there is a white space on the bottom and i don-t understand why, i try the resizedToAVoidBottomPadding but doesn-t work,I have insert a background image but there is a white space on the bottom and i don-t understand why, i try the resizedToAVoidBottomPadding but doesn-t workI have insert a background image but there is a white space on the bottom and i don-t understand why, i try the resizedToAVoidBottomPadding but doesn-t work
Have you try remove bottom safearea, safearea will occupy both top and bottom for notch and control area:
SafeArea(
bottom: false,