Skip to content

Commit

Permalink
Merge branch 'feature/focus' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bosskmk committed Feb 5, 2021
2 parents 911d9ff + 90e2aa4 commit 97d21ca
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 46 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.1.1] - 2021. 1. 22

* Changed the return value of FocusNode's onKey callback function from bool to KeyEventResult.

## [1.1.0] - 2021. 1. 16

* Add hide columns.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## PlutoGrid for flutter - v1.1.0
## PlutoGrid for flutter - v1.1.1

[![codecov](https://codecov.io/gh/bosskmk/pluto_grid/branch/master/graph/badge.svg)](https://codecov.io/gh/bosskmk/pluto_grid)

Expand Down
Binary file added example/assets/images/cat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions example/lib/screen/development_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ class _DevelopmentScreenState extends State<DevelopmentScreen> {
enableFilterMenuItem: false,
enableEditingMode: false,
renderer: (rendererContext) {
return Image.network(
'https://flutter.dev/assets/flutter-lockup-1caf6476beed76adec3c477586da54de6b552b2f42108ec5bc68dc63bae2df75.png');
return Image.asset('assets/images/cat.jpg');
},
),
];
Expand Down Expand Up @@ -182,33 +181,35 @@ class _DevelopmentScreenState extends State<DevelopmentScreen> {
scrollDirection: Axis.horizontal,
child: Container(
height: stateManager.headerHeight,
child: Row(
child: Wrap(
spacing: 10,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
FlatButton(
ElevatedButton(
child: const Text('Go Home'),
onPressed: () {
Navigator.pushNamed(context, HomeScreen.routeName);
},
),
FlatButton(
ElevatedButton(
child: const Text('Add 10'),
onPressed: () {
handleAddRowButton(count: 10);
},
),
FlatButton(
ElevatedButton(
child: const Text('Add 100 Rows'),
onPressed: () => handleAddRowButton(count: 100),
),
FlatButton(
ElevatedButton(
child: const Text('Add 100,000 Rows'),
onPressed: () => handleAddRowButton(count: 100000),
),
FlatButton(
ElevatedButton(
child: const Text('Remove Current Row'),
onPressed: handleRemoveCurrentRowButton,
),
FlatButton(
ElevatedButton(
child: const Text('Remove Selected Rows'),
onPressed: handleRemoveSelectedRowsButton,
),
Expand All @@ -234,7 +235,7 @@ class _DevelopmentScreenState extends State<DevelopmentScreen> {
},
),
),
FlatButton(
ElevatedButton(
child: const Text('Toggle filter'),
onPressed: handleToggleColumnFilter,
),
Expand Down
13 changes: 7 additions & 6 deletions example/lib/screen/feature/add_and_remove_rows_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,26 @@ class _AddAndRemoveRowsScreenState extends State<AddAndRemoveRowsScreen> {
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
child: Wrap(
spacing: 10,
children: [
FlatButton(
ElevatedButton(
child: const Text('Add a Row'),
onPressed: handleAddRowButton,
),
FlatButton(
ElevatedButton(
child: const Text('Add 100 Rows'),
onPressed: () => handleAddRowButton(count: 100),
),
FlatButton(
ElevatedButton(
child: const Text('Remove Current Row'),
onPressed: handleRemoveCurrentRowButton,
),
FlatButton(
ElevatedButton(
child: const Text('Remove Selected Rows'),
onPressed: handleRemoveSelectedRowsButton,
),
FlatButton(
ElevatedButton(
child: const Text('Toggle filtering'),
onPressed: handleFiltering,
),
Expand Down
3 changes: 1 addition & 2 deletions example/lib/screen/feature/cell_renderer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ class _CellRendererScreenState extends State<CellRendererScreen> {
type: PlutoColumnType.text(),
enableEditingMode: false,
renderer: (rendererContext) {
return Image.network(
'https://flutter.dev/assets/flutter-lockup-1caf6476beed76adec3c477586da54de6b552b2f42108ec5bc68dc63bae2df75.png');
return Image.asset('assets/images/cat.jpg');
},
),
];
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screen/feature/cell_selection_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class _CellSelectionScreenState extends State<CellSelectionScreen> {
scrollDirection: Axis.horizontal,
child: Row(
children: [
FlatButton(
ElevatedButton(
child: const Text('Show selected cells.'),
onPressed: handleSelected,
),
Expand Down
7 changes: 4 additions & 3 deletions example/lib/screen/feature/column_hiding_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ class _ColumnHidingScreenState extends State<ColumnHidingScreen> {
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
child: Wrap(
spacing: 10,
children: [
FlatButton(
ElevatedButton(
child: const Text('Toggle hide Column A'),
onPressed: handleToggleColumnA,
),
FlatButton(
ElevatedButton(
child: const Text('Show Popup'),
onPressed: () {
handleShowPopup(context);
Expand Down
24 changes: 18 additions & 6 deletions example/lib/screen/feature/listing_mode_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ class _ListingModeScreenState extends State<ListingModeScreen> {
const SizedBox(height: 15),
Center(
child: Wrap(
spacing: 10,
children: [
FlatButton(
TextButton(
onPressed: () {
Navigator.pop(ctx, null);
},
child: const Text('Cancel.'),
),
FlatButton(
ElevatedButton(
onPressed: () {
print(textController.text);
Navigator.pop(ctx, textController.text);
Expand All @@ -116,7 +117,12 @@ class _ListingModeScreenState extends State<ListingModeScreen> {
color: Colors.white,
),
),
color: Colors.blue,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(
Colors.blue,
),
),
),
],
),
Expand Down Expand Up @@ -182,14 +188,15 @@ class _ListingModeScreenState extends State<ListingModeScreen> {
const SizedBox(height: 20),
Center(
child: Wrap(
spacing: 10,
children: [
FlatButton(
TextButton(
onPressed: () {
Navigator.pop(ctx, null);
},
child: const Text('Cancel.'),
),
FlatButton(
ElevatedButton(
onPressed: () {
Navigator.pop(ctx, textController.text);
},
Expand All @@ -199,7 +206,12 @@ class _ListingModeScreenState extends State<ListingModeScreen> {
color: Colors.white,
),
),
color: Colors.blue,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(
Colors.blue,
),
),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screen/feature/row_selection_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class _RowSelectionScreenState extends State<RowSelectionScreen> {
scrollDirection: Axis.horizontal,
child: Row(
children: [
FlatButton(
TextButton(
child: const Text('Show selected rows.'),
onPressed: handleSelected,
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widget/pluto_example_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PlutoExampleButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return FlatButton.icon(
return TextButton.icon(
onPressed: () {
launchUrl(url);
},
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.1.1"
pluto_inside:
dependency: transitive
description:
Expand Down Expand Up @@ -282,4 +282,4 @@ packages:
version: "2.1.0-nullsafety.5"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0 <2.0.0"
flutter: ">=1.22.0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - assets/images/
assets:
- assets/images/

fonts:
- family: OpenSans
Expand Down
1 change: 1 addition & 0 deletions example/windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ add_custom_command(
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
Expand Down
4 changes: 2 additions & 2 deletions lib/src/pluto_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ class _PlutoGridState extends State<PlutoGrid> {
}
}

bool handleGridFocusOnKey(FocusNode focusNode, RawKeyEvent event) {
KeyEventResult handleGridFocusOnKey(FocusNode focusNode, RawKeyEvent event) {
keyManager.subject.add(PlutoKeyManagerEvent(
focusNode: focusNode,
event: event,
));

return true;
return KeyEventResult.handled;
}

void setLayout(BoxConstraints size) {
Expand Down
7 changes: 4 additions & 3 deletions lib/src/ui/cells/mixin_popup_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ mixin MixinPopupCell<T extends AbstractMixinPopupCell> on State<T>
);
}

bool _handleKeyboardFocusOnKey(FocusNode focusNode, RawKeyEvent event) {
KeyEventResult _handleKeyboardFocusOnKey(
FocusNode focusNode, RawKeyEvent event) {
PlutoKeyManagerEvent keyManagerEvent = PlutoKeyManagerEvent(
focusNode: focusNode,
event: event,
Expand All @@ -115,12 +116,12 @@ mixin MixinPopupCell<T extends AbstractMixinPopupCell> on State<T>
if (keyManagerEvent.isF2 || keyManagerEvent.isCharacter) {
if (isOpenedPopup != true) {
openPopup();
return true;
return KeyEventResult.handled;
}
}
}

return false;
return KeyEventResult.ignored;
}

void onLoaded(PlutoGridOnLoadedEvent event) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/columns/pluto_column_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ abstract class _PlutoColumnFilterStateWithChange
});
}

bool handleOnKey(FocusNode node, RawKeyEvent event) {
KeyEventResult handleOnKey(FocusNode node, RawKeyEvent event) {
var keyManager = PlutoKeyManagerEvent(
focusNode: node,
event: event,
Expand Down Expand Up @@ -121,7 +121,7 @@ abstract class _PlutoColumnFilterStateWithChange
}
}

return true;
return KeyEventResult.handled;
}

void handleFocusFromRows(PlutoGridEvent plutoEvent) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,4 @@ packages:
version: "2.2.1"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
flutter: ">=1.17.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pluto_grid
description: PlutoGrid is a dataGrid that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS. (DataGrid, DataTable, Data Grid, Data Table, Sticky)
version: 1.1.0
version: 1.1.1
homepage: https://bosskmk.github.io
repository: https://github.com/bosskmk/pluto_grid

Expand Down
4 changes: 2 additions & 2 deletions test/src/pluto_dual_grid_popup_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main() {
child: Builder(
builder: (BuildContext context) {
return Container(
child: FlatButton(
child: TextButton(
onPressed: () {
PlutoDualGridPopup(
context: context,
Expand All @@ -44,7 +44,7 @@ void main() {
);

// when
await tester.tap(find.byType(FlatButton));
await tester.tap(find.byType(TextButton));

await tester.pumpAndSettle();

Expand Down

0 comments on commit 97d21ca

Please sign in to comment.