blank.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
  2. import 'package:easy_localization/easy_localization.dart';
  3. import 'package:flowy_infra_ui/style_widget/text.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:app_flowy/generated/locale_keys.g.dart';
  6. import 'package:app_flowy/startup/plugin/plugin.dart';
  7. class BlankPluginBuilder extends PluginBuilder {
  8. @override
  9. Plugin build(dynamic data) {
  10. return BlankPagePlugin(pluginType: pluginType);
  11. }
  12. @override
  13. String get menuName => "Blank";
  14. @override
  15. PluginType get pluginType => PluginType.blank;
  16. }
  17. class BlankPluginConfig implements PluginConfig {
  18. @override
  19. bool get creatable => false;
  20. }
  21. class BlankPagePlugin extends Plugin {
  22. final PluginType _pluginType;
  23. BlankPagePlugin({
  24. required PluginType pluginType,
  25. }) : _pluginType = pluginType;
  26. @override
  27. PluginDisplay get display => BlankPagePluginDisplay();
  28. @override
  29. PluginId get id => "BlankStack";
  30. @override
  31. PluginType get ty => _pluginType;
  32. }
  33. class BlankPagePluginDisplay extends PluginDisplay with NavigationItem {
  34. @override
  35. Widget get leftBarItem =>
  36. FlowyText.medium(LocaleKeys.blankPageTitle.tr(), fontSize: 12);
  37. @override
  38. Widget buildWidget() => const BlankPage();
  39. @override
  40. List<NavigationItem> get navigationItems => [this];
  41. }
  42. class BlankPage extends StatefulWidget {
  43. const BlankPage({Key? key}) : super(key: key);
  44. @override
  45. State<BlankPage> createState() => _BlankPageState();
  46. }
  47. class _BlankPageState extends State<BlankPage> {
  48. @override
  49. Widget build(BuildContext context) {
  50. return SizedBox.expand(
  51. child: Container(
  52. color: Theme.of(context).colorScheme.surface,
  53. child: Padding(
  54. padding: const EdgeInsets.all(10),
  55. child: Container(),
  56. ),
  57. ),
  58. );
  59. }
  60. }