Skip to content

Instantly share code, notes, and snippets.

@manthri-mohan-sai
Last active September 13, 2021 04:35
Show Gist options
  • Save manthri-mohan-sai/f354e3999d0d5156597213a4058b6208 to your computer and use it in GitHub Desktop.
Save manthri-mohan-sai/f354e3999d0d5156597213a4058b6208 to your computer and use it in GitHub Desktop.
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.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
),
debugShowCheckedModeBanner: false,
home: const Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatefulWidget {
const MyWidget({Key? key}) : super(key: key);
@override
_MyWidgetState createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
Size get displayMetrics => MediaQuery.of(context).size;
@override
Widget build(BuildContext context) {
return Stack(alignment: Alignment.bottomCenter, children: [
Container(
width: displayMetrics.width,
height: displayMetrics.height,
color: Colors.blue,
child: Center(
child: Text(
'Image goes here',
style: Theme.of(context).textTheme.headline4,
),
),
), // Add image.asset here to load image
Container(
width: displayMetrics.width,
height: displayMetrics.height * 0.4,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32), topRight: Radius.circular(32))),
child: Center(
child: Text(
'Bottom widgets goes here',
style: Theme.of(context).textTheme.headline4?.copyWith(color: Colors.black),
),
),
)
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment