|
@@ -6,6 +6,7 @@ import 'package:flowy_infra/theme.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
|
|
+import 'package:flowy_sdk/log.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'field_type_extension.dart';
|
|
import 'field_type_extension.dart';
|
|
@@ -28,49 +29,19 @@ class GridFieldCell extends StatelessWidget {
|
|
final button = FlowyButton(
|
|
final button = FlowyButton(
|
|
hoverColor: theme.shader6,
|
|
hoverColor: theme.shader6,
|
|
onTap: () => _showActionSheet(context),
|
|
onTap: () => _showActionSheet(context),
|
|
- // rightIcon: svgWidget("editor/details", color: theme.iconColor),
|
|
|
|
leftIcon: svgWidget(state.field.fieldType.iconName(), color: theme.iconColor),
|
|
leftIcon: svgWidget(state.field.fieldType.iconName(), color: theme.iconColor),
|
|
text: FlowyText.medium(state.field.name, fontSize: 12),
|
|
text: FlowyText.medium(state.field.name, fontSize: 12),
|
|
padding: GridSize.cellContentInsets,
|
|
padding: GridSize.cellContentInsets,
|
|
);
|
|
);
|
|
|
|
|
|
- final line = InkWell(
|
|
|
|
- onTap: () {},
|
|
|
|
- child: GestureDetector(
|
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
|
- onHorizontalDragCancel: () {},
|
|
|
|
- onHorizontalDragUpdate: (value) {
|
|
|
|
- context.read<FieldCellBloc>().add(FieldCellEvent.updateWidth(value.delta.dx));
|
|
|
|
- },
|
|
|
|
- child: FlowyHover(
|
|
|
|
- style: HoverStyle(
|
|
|
|
- hoverColor: theme.main1,
|
|
|
|
- borderRadius: BorderRadius.zero,
|
|
|
|
- contentMargin: const EdgeInsets.only(left: 5),
|
|
|
|
- ),
|
|
|
|
- builder: (_, onHover) => const SizedBox(width: 2),
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- final borderSide = BorderSide(color: theme.shader4, width: 0.4);
|
|
|
|
- final decoration = BoxDecoration(
|
|
|
|
- border: Border(
|
|
|
|
- top: borderSide,
|
|
|
|
- right: borderSide,
|
|
|
|
- bottom: borderSide,
|
|
|
|
- ));
|
|
|
|
|
|
+ const line = Positioned(top: 0, bottom: 0, right: 0, child: _DragToExpandLine());
|
|
|
|
|
|
- return Container(
|
|
|
|
|
|
+ return _CellContainer(
|
|
width: state.field.width.toDouble(),
|
|
width: state.field.width.toDouble(),
|
|
- decoration: decoration,
|
|
|
|
- child: ConstrainedBox(
|
|
|
|
- constraints: const BoxConstraints.expand(),
|
|
|
|
- child: Stack(
|
|
|
|
- alignment: Alignment.centerRight,
|
|
|
|
- fit: StackFit.expand,
|
|
|
|
- children: [button, Positioned(top: 0, bottom: 0, right: 0, child: line)],
|
|
|
|
- ),
|
|
|
|
|
|
+ child: Stack(
|
|
|
|
+ alignment: Alignment.centerRight,
|
|
|
|
+ fit: StackFit.expand,
|
|
|
|
+ children: [button, line],
|
|
),
|
|
),
|
|
);
|
|
);
|
|
},
|
|
},
|
|
@@ -98,3 +69,65 @@ class GridFieldCell extends StatelessWidget {
|
|
).show(context);
|
|
).show(context);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+class _CellContainer extends StatelessWidget {
|
|
|
|
+ final Widget child;
|
|
|
|
+ final double width;
|
|
|
|
+ const _CellContainer({
|
|
|
|
+ required this.child,
|
|
|
|
+ required this.width,
|
|
|
|
+ Key? key,
|
|
|
|
+ }) : super(key: key);
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ final theme = context.watch<AppTheme>();
|
|
|
|
+ final borderSide = BorderSide(color: theme.shader4, width: 0.4);
|
|
|
|
+ final decoration = BoxDecoration(
|
|
|
|
+ border: Border(
|
|
|
|
+ top: borderSide,
|
|
|
|
+ right: borderSide,
|
|
|
|
+ bottom: borderSide,
|
|
|
|
+ ));
|
|
|
|
+
|
|
|
|
+ return Container(
|
|
|
|
+ width: width,
|
|
|
|
+ decoration: decoration,
|
|
|
|
+ child: ConstrainedBox(constraints: const BoxConstraints.expand(), child: child),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+class _DragToExpandLine extends StatelessWidget {
|
|
|
|
+ const _DragToExpandLine({
|
|
|
|
+ Key? key,
|
|
|
|
+ }) : super(key: key);
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ final theme = context.watch<AppTheme>();
|
|
|
|
+
|
|
|
|
+ return InkWell(
|
|
|
|
+ onTap: () {},
|
|
|
|
+ child: GestureDetector(
|
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
|
+ onHorizontalDragCancel: () {},
|
|
|
|
+ onHorizontalDragUpdate: (value) {
|
|
|
|
+ // context.read<FieldCellBloc>().add(FieldCellEvent.updateWidth(value.delta.dx));
|
|
|
|
+ Log.info(value);
|
|
|
|
+ },
|
|
|
|
+ onHorizontalDragEnd: (end) {
|
|
|
|
+ Log.info(end);
|
|
|
|
+ },
|
|
|
|
+ child: FlowyHover(
|
|
|
|
+ style: HoverStyle(
|
|
|
|
+ hoverColor: theme.main1,
|
|
|
|
+ borderRadius: BorderRadius.zero,
|
|
|
|
+ contentMargin: const EdgeInsets.only(left: 5),
|
|
|
|
+ ),
|
|
|
|
+ builder: (_, onHover) => const SizedBox(width: 2),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|