zefyr

main.dart 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright (c) 2018, the Zefyr project authors. Please see the AUTHORS file
  2. // for details. All rights reserved. Use of this source code is governed by a
  3. // BSD-style license that can be found in the LICENSE file.
  4. import 'package:flutter/material.dart';
  5. import 'src/form.dart';
  6. import 'src/full_page.dart';
  7. void main() {
  8. runApp(new ZefyrApp());
  9. }
  10. class ZefyrApp extends StatelessWidget {
  11. @override
  12. Widget build(BuildContext context) {
  13. return MaterialApp(
  14. debugShowCheckedModeBanner: false,
  15. title: 'Zefyr Editor',
  16. theme: ThemeData(primarySwatch: Colors.cyan),
  17. home: HomePage(),
  18. routes: {
  19. "/fullPage": buildFullPage,
  20. "/form": buildFormPage,
  21. },
  22. );
  23. }
  24. Widget buildFullPage(BuildContext context) {
  25. return FullPageEditorScreen();
  26. }
  27. Widget buildFormPage(BuildContext context) {
  28. return FormEmbeddedScreen();
  29. }
  30. }
  31. class HomePage extends StatelessWidget {
  32. @override
  33. Widget build(BuildContext context) {
  34. final nav = Navigator.of(context);
  35. return Scaffold(
  36. appBar: AppBar(
  37. elevation: 1.0,
  38. backgroundColor: Colors.grey.shade200,
  39. brightness: Brightness.light,
  40. title: ZefyrLogo(),
  41. ),
  42. body: Column(
  43. children: <Widget>[
  44. Expanded(child: Container()),
  45. FlatButton(
  46. onPressed: () => nav.pushNamed('/fullPage'),
  47. child: Text('Full page editor'),
  48. color: Colors.lightBlue,
  49. textColor: Colors.white,
  50. ),
  51. FlatButton(
  52. onPressed: () => nav.pushNamed('/form'),
  53. child: Text('Embedded in a form'),
  54. color: Colors.lightBlue,
  55. textColor: Colors.white,
  56. ),
  57. Expanded(child: Container()),
  58. ],
  59. ),
  60. );
  61. }
  62. }