Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made changes in set filter feature #1007

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0f40ac2
initiated
kiranpsvidealpha Jan 18, 2024
d2207bf
testing changes
kiranpsvidealpha Jan 18, 2024
e9fd8fe
changes
kiranpsvidealpha Jan 18, 2024
113c62b
f
kiranpsvidealpha Jan 18, 2024
6f37b32
fixes made
kiranpsvidealpha Jan 18, 2024
4be9816
modified package
kiranpsvidealpha Jan 19, 2024
8625cad
modified
kiranpsvidealpha Jan 19, 2024
d91b446
modified
kiranpsvidealpha Jan 19, 2024
0871508
changed color
kiranpsvidealpha Jan 19, 2024
c5aa98d
add reset filter
kiranpsvidealpha Jan 25, 2024
1da68ad
fixes
kiranpsvidealpha Jan 25, 2024
fd365dc
made changes
kiranpsvidealpha Jan 29, 2024
489de53
fixes
kiranpsvidealpha Jan 29, 2024
a9e56da
fixes
kiranpsvidealpha Jan 29, 2024
db9ee03
changes
kiranpsvidealpha Jan 29, 2024
24b0abb
changed key
kiranpsvidealpha Jan 29, 2024
13f3cba
parent
kiranpsvidealpha Jan 29, 2024
d7c307d
state
kiranpsvidealpha Jan 29, 2024
9961824
changes
kiranpsvidealpha Jan 29, 2024
7ba7d35
revert
kiranpsvidealpha Jan 29, 2024
41c5f4b
reset
kiranpsvidealpha Jan 29, 2024
566d0f7
fixes
kiranpsvidealpha Jan 29, 2024
1f60c22
filter final push
kiranpsvidealpha Jan 29, 2024
830f439
updated
kiranpsvidealpha Feb 7, 2024
c7a0e64
made changes
kiranpsvidealpha Feb 7, 2024
fa23619
new version
kiranpsvidealpha Feb 7, 2024
f11947b
changes
kiranpsvidealpha Feb 7, 2024
0486b8d
change
kiranpsvidealpha Feb 7, 2024
9f7e267
updated version with changes
kiranpsvidealpha Feb 8, 2024
7fece6c
migrated to latest version
kiranpsvidealpha Feb 15, 2024
640cba3
version updated
kiranpsvidealpha Feb 19, 2024
bb94103
version downgraded
kiranpsvidealpha Feb 19, 2024
ff28cf9
added stringNumber sorting
kiranpsvidealpha Feb 20, 2024
c68d5c9
fixes: plutocolumn sort
kiranpsvidealpha Feb 20, 2024
291caf7
changes
kiranpsvidealpha Feb 20, 2024
54f1a9b
fixes: duration and text
kiranpsvidealpha Feb 22, 2024
79a238c
fixes
kiranpsvidealpha Feb 22, 2024
2e6bc2e
feature displayValue
kiranpsvidealpha Feb 22, 2024
3d0cb16
changes
kiranpsvidealpha Feb 22, 2024
1463674
changes
kiranpsvidealpha Feb 22, 2024
f9c642e
changed pluto cell
kiranpsvidealpha Feb 22, 2024
6a2c7f3
changes
kiranpsvidealpha Feb 22, 2024
749af9b
changes reverted
kiranpsvidealpha Feb 22, 2024
4b5254f
fixes: bugs
kiranpsvidealpha Mar 11, 2024
ae0cf3a
updated
kiranpsvidealpha Mar 11, 2024
fa3bcc7
type duration added
kiranpsvidealpha Mar 19, 2024
9c78d77
new version
kiranpsvidealpha Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "stable",
"flutterSdkVersion": "3.16.9",
"flavors": {}
}
}
2 changes: 2 additions & 0 deletions .vscode/git-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { exec } = require('child_process');
exec('git commit -m "latest_deployment"');
2 changes: 2 additions & 0 deletions .vscode/git-push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { exec } = require('child_process');
exec('git push origin');
2 changes: 2 additions & 0 deletions .vscode/git-stage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { exec } = require('child_process');
exec('git add .');
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
17 changes: 9 additions & 8 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'PlutoGrid Example',
theme: ThemeData(
useMaterial3: false,
primarySwatch: Colors.blue,
),
home: const PlutoGridExamplePage(),
Expand All @@ -35,12 +36,12 @@ class _PlutoGridExamplePageState extends State<PlutoGridExamplePage> {
PlutoColumn(
title: 'Id',
field: 'id',
type: PlutoColumnType.text(),
type: PlutoColumnType.duration(),
),
PlutoColumn(
title: 'Name',
field: 'name',
type: PlutoColumnType.text(),
type: PlutoColumnType.duration(),
),
PlutoColumn(
title: 'Age',
Expand Down Expand Up @@ -95,8 +96,8 @@ class _PlutoGridExamplePageState extends State<PlutoGridExamplePage> {
final List<PlutoRow> rows = [
PlutoRow(
cells: {
'id': PlutoCell(value: 'user1'),
'name': PlutoCell(value: 'Mike'),
'id': PlutoCell(value: 'user 113'),
'name': PlutoCell(value: '1111 days'),
'age': PlutoCell(value: 20),
'role': PlutoCell(value: 'Programmer'),
'joined': PlutoCell(value: '2021-01-01'),
Expand All @@ -106,8 +107,8 @@ class _PlutoGridExamplePageState extends State<PlutoGridExamplePage> {
),
PlutoRow(
cells: {
'id': PlutoCell(value: 'user2'),
'name': PlutoCell(value: 'Jack'),
'id': PlutoCell(value: 'user 212'),
'name': PlutoCell(value: '210 days'),
'age': PlutoCell(value: 25),
'role': PlutoCell(value: 'Designer'),
'joined': PlutoCell(value: '2021-02-01'),
Expand All @@ -117,8 +118,8 @@ class _PlutoGridExamplePageState extends State<PlutoGridExamplePage> {
),
PlutoRow(
cells: {
'id': PlutoCell(value: 'user3'),
'name': PlutoCell(value: 'Suzi'),
'id': PlutoCell(value: 'user 312'),
'name': PlutoCell(value: '2111210 days'),
'age': PlutoCell(value: 40),
'role': PlutoCell(value: 'Owner'),
'joined': PlutoCell(value: '2021-03-01'),
Expand Down
10 changes: 5 additions & 5 deletions example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version
//

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,0
#define VERSION_AS_NUMBER 1,0,0,0
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.0"
#endif
Expand Down
86 changes: 49 additions & 37 deletions lib/src/helper/filter_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart';

typedef SetFilterPopupHandler = void Function(
PlutoGridStateManager? stateManager);
import '../ui/columns/pluto_column_title.dart';

typedef SetFilterPopupHandler = void Function(PlutoGridStateManager? stateManager);

class FilterHelper {
/// A value to identify all column searches when searching filters.
Expand Down Expand Up @@ -41,10 +42,8 @@ class FilterHelper {
}) {
return PlutoRow(
cells: {
filterFieldColumn:
PlutoCell(value: columnField ?? filterFieldAllColumns),
filterFieldType:
PlutoCell(value: filterType ?? const PlutoFilterTypeContains()),
filterFieldColumn: PlutoCell(value: columnField ?? filterFieldAllColumns),
filterFieldType: PlutoCell(value: filterType ?? const PlutoFilterTypeContains()),
filterFieldValue: PlutoCell(value: filterValue ?? ''),
},
);
Expand Down Expand Up @@ -97,8 +96,7 @@ class FilterHelper {
flag,
compareByFilterType(
filterType: filterType!,
base: row!.cells[e.cells[filterFieldColumn]!.value]!.value
.toString(),
base: row!.cells[e.cells[filterFieldColumn]!.value]!.value.toString(),
search: e.cells[filterFieldValue]!.value.toString(),
column: foundColumn,
),
Expand Down Expand Up @@ -139,9 +137,7 @@ class FilterHelper {
columnField = allField;
}

final String filterType =
(row.cells[FilterHelper.filterFieldType]!.value as PlutoFilterType)
.title;
final String filterType = (row.cells[FilterHelper.filterFieldType]!.value as PlutoFilterType).title;

final filterValue = row.cells[FilterHelper.filterFieldValue]!.value;

Expand Down Expand Up @@ -171,8 +167,7 @@ class FilterHelper {
}

for (var row in filteredRows) {
if (row!.cells[filterFieldColumn]!.value == filterFieldAllColumns ||
row.cells[filterFieldColumn]!.value == column.field) {
if (row!.cells[filterFieldColumn]!.value == filterFieldAllColumns || row.cells[filterFieldColumn]!.value == column.field) {
return true;
}
}
Expand Down Expand Up @@ -447,8 +442,7 @@ class FilterPopupState {
required List<PlutoColumn> columns,
}) {
Map<String, String> columnMap = {
FilterHelper.filterFieldAllColumns:
configuration.localeText.filterAllColumns,
FilterHelper.filterFieldAllColumns: configuration.localeText.filterAllColumns,
};

columns.where((element) => element.enableFilterMenuItem).forEach((element) {
Expand Down Expand Up @@ -523,36 +517,54 @@ class PlutoGridFilterPopupHeader extends StatelessWidget {
}

void handleClearButton() {
if (stateManager!.rows.isEmpty) {
Navigator.of(stateManager!.gridFocusNode.context!).pop();
} else {
stateManager!.removeRows(stateManager!.rows);
}
stateManager!.removeRows(stateManager!.rows);
}

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
Size size = MediaQuery.sizeOf(context);
return SizedBox(
width: size.width,
child: Row(
children: [
IconButton(
icon: const Icon(Icons.add),
color: configuration!.style.iconColor,
iconSize: configuration!.style.iconSize,
onPressed: handleAddButton,
Row(
children: [
IconButton(
icon: const Icon(Icons.add),
color: configuration!.style.iconColor,
iconSize: configuration!.style.iconSize,
onPressed: handleAddButton,
),
IconButton(
icon: const Icon(Icons.remove),
color: configuration!.style.iconColor,
iconSize: configuration!.style.iconSize,
onPressed: handleRemoveButton,
),
InkWell(
onTap: handleClearButton,
child: const Text(
'Clear Filter',
style: TextStyle(color: Colors.blue),
),
),
],
),
IconButton(
icon: const Icon(Icons.remove),
color: configuration!.style.iconColor,
iconSize: configuration!.style.iconSize,
onPressed: handleRemoveButton,
const SizedBox(
width: 370,
),
IconButton(
icon: const Icon(Icons.clear_sharp),
color: Colors.red,
iconSize: configuration!.style.iconSize,
onPressed: handleClearButton,
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.redAccent),
),
onPressed: () {
Navigator.of(stateManager!.gridFocusNode.context!).pop();
isFiltered = false;
},
child: const Text(
'Close',
style: TextStyle(color: Colors.white),
),
),
],
),
Expand Down
Loading