Skip to content

Instantly share code, notes, and snippets.

@Ivy-Walobwa
Last active July 25, 2022 07:15
Show Gist options
  • Save Ivy-Walobwa/af2366cb43e2303b634cce09d7bac8f7 to your computer and use it in GitHub Desktop.
Save Ivy-Walobwa/af2366cb43e2303b634cce09d7bac8f7 to your computer and use it in GitHub Desktop.
Flutter Local push notifications UI
import 'package:flutter/material.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
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: 'Just Water',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("JustWater"),
centerTitle: true,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(bottom: 100),
// Update with local image
child: Image.asset("assets/images/justwater.png", scale: 0.6),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(onPressed: () {}, child: const Text("Drink Now")),
ElevatedButton(
onPressed: () {}, child: const Text("Schedule Drink "))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
onPressed: () {}, child: const Text("Drink grouped")),
ElevatedButton(
onPressed: () {},
child: const Text(
"Cancel All Drinks",
),
)
],
),
],
),
);
}
}
class MySecondScreen extends StatelessWidget {
final String payload;
const MySecondScreen({Key? key, required this.payload}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("JustWater"),
centerTitle: true,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(bottom: 100),
child: Image.asset(
"assets/images/justwater.png",
),
),
Text(payload)
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment