Skip to content

Commit 06c5f6a

Browse files
authored
Merge branch 'main' into feat_1624
2 parents 35a72f7 + 1a2af1c commit 06c5f6a

File tree

7 files changed

+90
-44
lines changed

7 files changed

+90
-44
lines changed

.github/workflows/flutter_ci.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
job:
28-
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest,}
29-
- { target: x86_64-apple-darwin, os: macos-latest, }
30-
- { target: x86_64-pc-windows-msvc, os: windows-latest, }
27+
os: [ubuntu-latest, macos-latest, windows-latest]
3128
include:
3229
- os: ubuntu-latest
3330
flutter_profile: development-linux-x86_64
31+
target: x86_64-unknown-linux-gnu
3432
- os: macos-latest
3533
flutter_profile: development-mac-x86_64
34+
target: x86_64-apple-darwin
3635
- os: windows-latest
3736
flutter_profile: development-windows-x86
37+
target: x86_64-pc-windows-msvc
3838
runs-on: ${{ matrix.os }}
3939

4040
steps:
@@ -46,9 +46,8 @@ jobs:
4646
uses: actions-rs/toolchain@v1
4747
with:
4848
toolchain: ${{ env.RUST_TOOLCHAIN }}
49-
target: ${{ matrix.job.target }}
49+
target: ${{ matrix.target }}
5050
override: true
51-
components: rustfmt
5251
profile: minimal
5352

5453
- name: Install flutter
@@ -68,18 +67,18 @@ jobs:
6867
run: |
6968
cargo install --force cargo-make
7069
cargo install --force duckscript_cli
71-
cargo make appflowy-deps-tools
7270
if [ "$RUNNER_OS" == "Linux" ]; then
7371
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
7472
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
7573
sudo apt-get update
76-
sudo apt-get install -y dart curl build-essential libsqlite3-dev libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
74+
sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
7775
sudo apt-get install keybinder-3.0
7876
elif [ "$RUNNER_OS" == "Windows" ]; then
7977
vcpkg integrate install
8078
elif [ "$RUNNER_OS" == "macOS" ]; then
8179
echo 'do nothing'
8280
fi
81+
cargo make appflowy-deps-tools
8382
shell: bash
8483

8584
- name: Enable Flutter Desktop
@@ -102,16 +101,12 @@ jobs:
102101
working-directory: frontend/app_flowy
103102
run: flutter analyze
104103

105-
- name: Build Flutter unit test lib
106-
working-directory: frontend
107-
run: |
108-
cargo make build-test-lib
109-
110104
- name: Run Flutter unit tests
111-
working-directory: frontend/app_flowy
105+
working-directory: frontend
112106
run: |
113-
if [ "$RUNNER_OS" == "Linux" ]; then
114-
flutter pub get
115-
flutter test
107+
if [ "$RUNNER_OS" == "macOS" ]; then
108+
cargo make dart_unit_test
109+
elif [ "$RUNNER_OS" == "Windows" ]; then
110+
cargo make dart_unit_test
116111
fi
117-
shell: bash
112+
shell: bash

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dart

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import 'package:flowy_infra/image.dart';
12
import 'package:flowy_infra/theme_extension.dart';
23
import 'package:flowy_infra/size.dart';
34
import 'package:flowy_infra_ui/style_widget/hover.dart';
5+
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
46
import 'package:flowy_infra_ui/style_widget/text.dart';
57
import 'package:flowy_sdk/protobuf/flowy-grid/select_type_option.pb.dart';
68
import 'package:flutter/material.dart';
@@ -62,39 +64,63 @@ extension SelectOptionColorExtension on SelectOptionColorPB {
6264
class SelectOptionTag extends StatelessWidget {
6365
final String name;
6466
final Color color;
65-
final bool isSelected;
6667
final VoidCallback? onSelected;
68+
final void Function(String)? onRemove;
6769
const SelectOptionTag({
6870
required this.name,
6971
required this.color,
7072
this.onSelected,
71-
this.isSelected = false,
73+
this.onRemove,
7274
Key? key,
7375
}) : super(key: key);
7476

7577
factory SelectOptionTag.fromOption({
7678
required BuildContext context,
7779
required SelectOptionPB option,
7880
VoidCallback? onSelected,
79-
bool isSelected = false,
81+
Function(String)? onRemove,
8082
}) {
8183
return SelectOptionTag(
8284
name: option.name,
8385
color: option.color.make(context),
84-
isSelected: isSelected,
8586
onSelected: onSelected,
87+
onRemove: onRemove,
8688
);
8789
}
8890

8991
@override
9092
Widget build(BuildContext context) {
93+
EdgeInsets padding =
94+
const EdgeInsets.symmetric(vertical: 2.0, horizontal: 8.0);
95+
if (onRemove != null) {
96+
padding = padding.copyWith(right: 2.0);
97+
}
98+
9199
return Container(
92-
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 8.0),
100+
padding: padding,
93101
decoration: BoxDecoration(
94102
color: color,
95103
borderRadius: Corners.s6Border,
96104
),
97-
child: FlowyText.medium(name, overflow: TextOverflow.ellipsis),
105+
child: Row(
106+
mainAxisSize: MainAxisSize.min,
107+
children: [
108+
Flexible(
109+
child: FlowyText.medium(name, overflow: TextOverflow.ellipsis),
110+
),
111+
if (onRemove != null)
112+
FlowyIconButton(
113+
width: 18.0,
114+
onPressed: () => onRemove?.call(name),
115+
fillColor: Colors.transparent,
116+
hoverColor: Colors.transparent,
117+
icon: svgWidget(
118+
'home/close',
119+
color: Theme.of(context).colorScheme.onSurface,
120+
),
121+
),
122+
],
123+
),
98124
);
99125
}
100126
}

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ class _TextField extends StatelessWidget {
159159
remainder,
160160
));
161161
},
162+
onRemove: (optionName) {
163+
context
164+
.read<SelectOptionCellEditorBloc>()
165+
.add(SelectOptionEditorEvent.unSelectOption(
166+
optionMap[optionName]!.id,
167+
));
168+
},
162169
),
163170
);
164171
},
@@ -297,6 +304,7 @@ class _SelectOptionCellState extends State<_SelectOptionCell> {
297304
context
298305
.read<SelectOptionCellEditorBloc>()
299306
.add(SelectOptionEditorEvent.deleteOption(widget.option));
307+
PopoverContainer.of(popoverContext).close();
300308
},
301309
onUpdated: (updatedOption) {
302310
context

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class SelectOptionTextField extends StatefulWidget {
2222
final Function(String) onSubmitted;
2323
final Function(String) newText;
2424
final Function(List<String>, String) onPaste;
25+
final Function(String) onRemove;
2526
final VoidCallback? onClick;
2627
final int? maxLength;
2728

@@ -32,6 +33,7 @@ class SelectOptionTextField extends StatefulWidget {
3233
required this.tagController,
3334
required this.onSubmitted,
3435
required this.onPaste,
36+
required this.onRemove,
3537
required this.newText,
3638
required this.textSeparators,
3739
this.onClick,
@@ -163,25 +165,31 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
163165
}
164166

165167
final children = widget.selectedOptionMap.values
166-
.map((option) =>
167-
SelectOptionTag.fromOption(context: context, option: option))
168+
.map((option) => SelectOptionTag.fromOption(
169+
context: context,
170+
option: option,
171+
onRemove: (option) => widget.onRemove(option),
172+
))
168173
.toList();
169-
return Padding(
170-
padding: const EdgeInsets.all(8.0),
171-
child: ScrollConfiguration(
172-
behavior: ScrollConfiguration.of(context).copyWith(
173-
dragDevices: {
174-
PointerDeviceKind.mouse,
175-
PointerDeviceKind.touch,
176-
PointerDeviceKind.trackpad,
177-
PointerDeviceKind.stylus,
178-
PointerDeviceKind.invertedStylus,
179-
},
180-
),
181-
child: SingleChildScrollView(
182-
controller: sc,
183-
scrollDirection: Axis.horizontal,
184-
child: Wrap(spacing: 4, children: children),
174+
return MouseRegion(
175+
cursor: SystemMouseCursors.basic,
176+
child: Padding(
177+
padding: const EdgeInsets.all(8.0),
178+
child: ScrollConfiguration(
179+
behavior: ScrollConfiguration.of(context).copyWith(
180+
dragDevices: {
181+
PointerDeviceKind.mouse,
182+
PointerDeviceKind.touch,
183+
PointerDeviceKind.trackpad,
184+
PointerDeviceKind.stylus,
185+
PointerDeviceKind.invertedStylus,
186+
},
187+
),
188+
child: SingleChildScrollView(
189+
controller: sc,
190+
scrollDirection: Axis.horizontal,
191+
child: Wrap(spacing: 4, children: children),
192+
),
185193
),
186194
),
187195
);

frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/section.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class ViewSection extends StatelessWidget {
4040
);
4141
}
4242

43-
ReorderableColumn _reorderableColum(BuildContext context, ViewSectionState state) {
43+
ReorderableColumn _reorderableColum(
44+
BuildContext context, ViewSectionState state) {
4445
final children = state.views.map((view) {
4546
return ViewSectionItem(
4647
key: ValueKey(view.id),
@@ -53,8 +54,11 @@ class ViewSection extends StatelessWidget {
5354
return ReorderableColumn(
5455
needsLongPressDraggable: false,
5556
onReorder: (oldIndex, index) {
56-
context.read<ViewSectionBloc>().add(ViewSectionEvent.moveView(oldIndex, index));
57+
context
58+
.read<ViewSectionBloc>()
59+
.add(ViewSectionEvent.moveView(oldIndex, index));
5760
},
61+
ignorePrimaryScrollController: true,
5862
children: children,
5963
);
6064
}

frontend/app_flowy/test/widget_test/select_option_text_field_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void main() {
2828
remainder = remaining;
2929
select = options;
3030
},
31+
onRemove: (_) {},
3132
newText: (text) => remainder = text,
3233
textSeparators: const [','],
3334
textController: TextEditingController(),

frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ mod tests {
1616
// the checkout value will be checked if the value is "1", "true" or "yes"
1717
assert_checkbox(&type_option, "1", CHECK, &field_type, &field_rev);
1818
assert_checkbox(&type_option, "true", CHECK, &field_type, &field_rev);
19+
assert_checkbox(&type_option, "TRUE", CHECK, &field_type, &field_rev);
1920
assert_checkbox(&type_option, "yes", CHECK, &field_type, &field_rev);
21+
assert_checkbox(&type_option, "YES", CHECK, &field_type, &field_rev);
2022

2123
// the checkout value will be uncheck if the value is "false" or "No"
2224
assert_checkbox(&type_option, "false", UNCHECK, &field_type, &field_rev);
2325
assert_checkbox(&type_option, "No", UNCHECK, &field_type, &field_rev);
26+
assert_checkbox(&type_option, "NO", UNCHECK, &field_type, &field_rev);
27+
assert_checkbox(&type_option, "0", UNCHECK, &field_type, &field_rev);
2428

2529
// the checkout value will be empty if the value is letters or empty string
2630
assert_checkbox(&type_option, "abc", "", &field_type, &field_rev);

0 commit comments

Comments
 (0)