Line data Source code
1 : import 'package:flutter/material.dart';
2 : import 'package:pal/src/ui/editor/pages/media_gallery/media_gallery.dart';
3 :
4 : import '../../../../../router.dart';
5 : import '../../../../../theme.dart';
6 : import 'editor_button.dart';
7 :
8 : typedef OnCancel();
9 :
10 : typedef OnValidate = Future<void> Function();
11 :
12 :
13 : class EditorActionsBar extends StatelessWidget {
14 :
15 : final Widget child;
16 : final OnCancel onCancel;
17 : final OnValidate onValidate;
18 : final ValueNotifier<bool> canValidate;
19 :
20 3 : EditorActionsBar({this.child, this.onCancel, this.onValidate, this.canValidate, Key key})
21 3 : : super(key: key);
22 :
23 3 : @override
24 : Widget build(BuildContext context) {
25 3 : return Stack(
26 3 : children: [
27 3 : Positioned(
28 : top: 0, left: 0, right: 0,
29 : bottom: 72,
30 3 : child: child,
31 : ),
32 3 : _buildValidationActions(context)
33 : ],
34 : );
35 : }
36 :
37 3 : Widget _buildValidationActions(final BuildContext context) {
38 3 : return Positioned(
39 : bottom: 0,
40 : left: 0,
41 : right: 0,
42 : height: 72,
43 3 : child: Container(
44 6 : color: PalTheme.of(context).toolbarBackgroundColor,
45 3 : child: Row(
46 : mainAxisAlignment: MainAxisAlignment.center,
47 3 : children: [
48 3 : EditorButton.cancel(
49 3 : PalTheme.of(context),
50 3 : onCancel,
51 3 : key: ValueKey("editModeCancel"),
52 : ),
53 3 : Padding(
54 3 : padding: EdgeInsets.only(left: 16),
55 3 : child: ValueListenableBuilder<bool>(
56 3 : valueListenable: canValidate,
57 3 : builder: (context, isActive, child)
58 3 : => EditorButton.validate(
59 3 : PalTheme.of(context),
60 3 : onValidate,
61 3 : key: ValueKey("editModeValidate"),
62 : isEnabled: isActive,
63 : ),
64 : ),
65 : ),
66 : ],
67 : ),
68 : ),
69 : );
70 : }
71 : }
|