Skip to content

Instantly share code, notes, and snippets.

@agreensh
Created August 30, 2022 20:05
Show Gist options
  • Select an option

  • Save agreensh/fbc0e4e816f2213a8e659dbfcdf9f3c9 to your computer and use it in GitHub Desktop.

Select an option

Save agreensh/fbc0e4e816f2213a8e659dbfcdf9f3c9 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: LayoutBuilder(builder: (context, constraints) {
final width = constraints.maxWidth;
return Stack(
children: [
Positioned(
bottom: 0,
child: Container(width: width, height: 200, color: Colors.white),
),
Positioned(
top: 0,
child: Container(width: width, height: 200, color: Colors.blue),
),
const MyHomePage(title: 'Flutter Demo Home Page'),
],
);
}),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
title: Text(widget.title),
),
body: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20)),
child: const Padding(
padding: EdgeInsets.all(16.0),
child: Text('Your Body Here'),
),
),
bottomNavigationBar: Material(
elevation: 8,
borderRadius: BorderRadius.circular(20),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: BottomAppBar(
color: Colors.white,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextButton.icon(
icon: const Icon(Icons.home),
label: const Text(
'Acceuil',
style: TextStyle(
fontSize: 20,
),
),
onPressed: () {
// Get.to(HomeScreen());
},
),
TextButton.icon(
icon: const Icon(Icons.person),
label: const Text(
'Profile',
style: TextStyle(
fontSize: 20,
),
),
onPressed: null,
),
],
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment