I am trying to change the default position of listView items as it is starting below AppBar But I want it to start with AppBar. Here is the code for ListView That I am using
ListView(
children: [
Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/backgroundHome.png',
),
fit: BoxFit.fill,
colorFilter:
ColorFilter.mode(Colors.black45, BlendMode.difference),
)),
child: Align(
alignment: Alignment.centerLeft,
child: RichText(
text: const TextSpan(
style: TextStyle(
fontFamily: "Inter",
fontSize: 40,
fontWeight: FontWeight.bold),
children: [
WidgetSpan(
child: Padding(
padding: EdgeInsets.only(left: 60),
child: Text("Where Dreams Take Flight:",
style: TextStyle(
fontFamily: "Inter",
color: Colors.white,
fontSize: 50,
fontWeight: FontWeight.bold)),
)),
WidgetSpan(
child: Padding(
padding: EdgeInsets.only(left: 50),
child: Text("Explore the globe with Travel Eyes",
style: TextStyle(
fontFamily: "Inter",
color: Colors.white,
fontSize: 50,
fontWeight: FontWeight.bold)),
))
]),
)),
),
Container(
color: Colors.orange,
height: 100,
)
],
),
- The Result I am getting
- The Result I want
2
Answers
You can wrap the
ListView
inside a Column and place theAppBar
widget above theListView.
Result:
You can wrap your ListView with Scaffold, and then put this property,
extendBodyBehindAppBar: true
Hope this helps!