82 lines
1.8 KiB
Markdown
82 lines
1.8 KiB
Markdown
# storyboards
|
|
|
|
```dart
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:storyboard/storyboard.dart';
|
|
|
|
void main() {
|
|
runApp(MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return StoryBoard.material(
|
|
child: MaterialApp(
|
|
debugShowCheckedModeBanner: false,
|
|
title: 'Flutter Storyboard Example',
|
|
theme: ThemeData.light().copyWith(
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
),
|
|
darkTheme: ThemeData.dark().copyWith(
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
),
|
|
themeMode: ThemeMode.light,
|
|
home: HomeScreen(),
|
|
routes: {
|
|
'/home': (_) => HomeScreen(),
|
|
'/about': (_) => AboutScreen(),
|
|
'/settings': (_) => SettingsScreen(),
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomeScreen extends StatelessWidget {
|
|
const HomeScreen({Key key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Home Screen'),
|
|
),
|
|
floatingActionButton: FloatingActionButton(
|
|
child: Icon(Icons.add),
|
|
onPressed: () {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (_) => SettingsScreen(),
|
|
));
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SettingsScreen extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Settings'),
|
|
),
|
|
backgroundColor: Colors.blue.shade300,
|
|
);
|
|
}
|
|
}
|
|
|
|
class AboutScreen extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('About'),
|
|
),
|
|
backgroundColor: Colors.red.shade300,
|
|
);
|
|
}
|
|
}
|
|
|
|
``` |