Skip to content

Instantly share code, notes, and snippets.

@bradcypert
Created August 11, 2020 20:04
Show Gist options
  • Save bradcypert/9d6b30f43fff419b1a0a74cc2f801801 to your computer and use it in GitHub Desktop.
Save bradcypert/9d6b30f43fff419b1a0a74cc2f801801 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final 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,
initialRoute: '/1',
routes: {
'/1': (ctx) => Widget1(),
'/2': (ctx) => Widget2(),
'/3': (ctx) => Widget3(),
}
);
}
}
class MyScaffold extends StatelessWidget {
final Widget body;
MyScaffold({this.body});
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: Drawer(
child: const Text('In the Drawer', textAlign: TextAlign.center),
),
body: this.body
);
}
}
class Widget1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MyScaffold(
body: Text('Widget 1', style: Theme.of(context).textTheme.headline4)
);
}
}
class Widget2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MyScaffold(
body: Text('Widget 2', style: Theme.of(context).textTheme.headline4)
);
}
}
class Widget3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MyScaffold(
body: Text('Widget 3', style: Theme.of(context).textTheme.headline4)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment