board_toolbar.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import 'package:app_flowy/plugins/grid/application/field/field_cache.dart';
  2. import 'package:appflowy_popover/popover.dart';
  3. import 'package:flowy_infra/image.dart';
  4. import 'package:flowy_infra/theme.dart';
  5. import 'package:flowy_infra_ui/style_widget/icon_button.dart';
  6. import 'package:flutter/widgets.dart';
  7. import 'package:provider/provider.dart';
  8. import 'board_setting.dart';
  9. class BoardToolbarContext {
  10. final String viewId;
  11. final GridFieldCache fieldCache;
  12. BoardToolbarContext({
  13. required this.viewId,
  14. required this.fieldCache,
  15. });
  16. }
  17. class BoardToolbar extends StatelessWidget {
  18. final BoardToolbarContext toolbarContext;
  19. const BoardToolbar({
  20. required this.toolbarContext,
  21. Key? key,
  22. }) : super(key: key);
  23. @override
  24. Widget build(BuildContext context) {
  25. return SizedBox(
  26. height: 40,
  27. child: Row(
  28. children: [
  29. _SettingButton(
  30. settingContext: BoardSettingContext.from(toolbarContext),
  31. ),
  32. ],
  33. ),
  34. );
  35. }
  36. }
  37. class _SettingButton extends StatelessWidget {
  38. final BoardSettingContext settingContext;
  39. const _SettingButton({required this.settingContext, Key? key})
  40. : super(key: key);
  41. @override
  42. Widget build(BuildContext context) {
  43. final theme = context.read<AppTheme>();
  44. return Popover(
  45. triggerActions: PopoverTriggerActionFlags.click,
  46. child: FlowyIconButton(
  47. hoverColor: theme.hover,
  48. width: 22,
  49. onPressed: () {},
  50. icon: Padding(
  51. padding: const EdgeInsets.symmetric(vertical: 3.0, horizontal: 3.0),
  52. child: svgWidget("grid/setting/setting"),
  53. ),
  54. ),
  55. popupBuilder: (BuildContext popoverContext) {
  56. return BoardSettingListPopover(
  57. settingContext: settingContext,
  58. );
  59. },
  60. );
  61. }
  62. }