-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
165 additions
and
17 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
...ppflowy_flutter/lib/plugins/document/presentation/editor_plugins/table/shared_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import 'package:appflowy/generated/flowy_svgs.g.dart'; | ||
import 'package:appflowy/plugins/document/presentation/editor_plugins/table/simple_table_constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SimpleTableAddRowButton extends StatelessWidget { | ||
const SimpleTableAddRowButton({ | ||
super.key, | ||
this.onTap, | ||
}); | ||
|
||
final VoidCallback? onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onTap: onTap, | ||
child: MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: Container( | ||
height: SimpleTableConstants.addRowButtonHeight, | ||
margin: const EdgeInsets.symmetric( | ||
vertical: SimpleTableConstants.addRowButtonPadding, | ||
), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular( | ||
SimpleTableConstants.addRowButtonRadius, | ||
), | ||
color: SimpleTableConstants.addRowButtonBackgroundColor, | ||
), | ||
child: const FlowySvg( | ||
FlowySvgs.add_s, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class SimpleTableAddColumnButton extends StatelessWidget { | ||
const SimpleTableAddColumnButton({ | ||
super.key, | ||
this.onTap, | ||
}); | ||
|
||
final VoidCallback? onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onTap: onTap, | ||
child: MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: Container( | ||
width: SimpleTableConstants.addColumnButtonWidth, | ||
margin: const EdgeInsets.symmetric( | ||
horizontal: SimpleTableConstants.addColumnButtonPadding, | ||
), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular( | ||
SimpleTableConstants.addColumnButtonRadius, | ||
), | ||
color: SimpleTableConstants.addColumnButtonBackgroundColor, | ||
), | ||
child: const FlowySvg( | ||
FlowySvgs.add_s, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
...lutter/lib/plugins/document/presentation/editor_plugins/table/simple_table_constants.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import 'dart:ui'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SimpleTableConstants { | ||
static const defaultColumnWidth = 120.0; | ||
static const minimumColumnWidth = 50.0; | ||
static const borderColor = Color(0xFFE4E5E5); | ||
|
||
static const addRowButtonHeight = 16.0; | ||
static const addRowButtonPadding = 2.0; | ||
static const addRowButtonBackgroundColor = Color(0xFFF2F3F5); | ||
static const addRowButtonRadius = 4.0; | ||
|
||
static const addColumnButtonWidth = 16.0; | ||
static const addColumnButtonPadding = 2.0; | ||
static const addColumnButtonBackgroundColor = Color(0xFFF2F3F5); | ||
static const addColumnButtonRadius = 4.0; | ||
|
||
static const cellEdgePadding = EdgeInsets.symmetric( | ||
horizontal: 8.0, | ||
vertical: 2.0, | ||
); | ||
} |