Skip to content

Instantly share code, notes, and snippets.

@kumar-aakash86
Created January 13, 2023 12:36
Show Gist options
  • Save kumar-aakash86/92c59353b949ed0c1cf99843ddb9ccbb to your computer and use it in GitHub Desktop.
Save kumar-aakash86/92c59353b949ed0c1cf99843ddb9ccbb to your computer and use it in GitHub Desktop.
Flutter - Stack with listview
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light().copyWith(
scaffoldBackgroundColor: Colors.grey.shade100,
primaryColor: Colors.amber,
),
debugShowCheckedModeBanner: false,
home: MyWidget());
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Hello world"),
elevation: 0,
backgroundColor: Theme.of(context).primaryColor,
),
body: Stack(
fit: StackFit.loose,
children: [
Container(color: Theme.of(context).primaryColor, height: 150),
Align(
alignment: Alignment.topLeft,
heightFactor: 1,
child: ListView(
shrinkWrap: false,
padding: const EdgeInsets.all(16.0),
children: [
Row(children: [
Expanded(
child: Container(
padding: const EdgeInsets.only(right: 8),
color: Colors.white,
height: 30),
),
Icon(Icons.search)
]),
const SizedBox(
height: 16,
),
Card(
elevation: 8,
child: Container(
color: Colors.white,
child: Text("Add calendar here"),
height: 200),
),
const SizedBox(
height: 16,
),
Card(
elevation: 8,
child: Container(
color: Colors.white,
child: Text("Today Section"),
height: 100),
),
const SizedBox(
height: 16,
),
Card(
elevation: 8,
child: Container(
color: Colors.white,
child: Text("Tomorrow Section"),
height: 100),
),
const SizedBox(
height: 16,
),
Card(
elevation: 8,
child: Container(
color: Colors.white,
child: Text("Any other Section"),
height: 100),
),
],
),
)
]),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment