Skip to content

Commit

Permalink
Merge branch 'main' into prod/festapp
Browse files Browse the repository at this point in the history
  • Loading branch information
miakh committed Nov 1, 2024
2 parents 59c0a3d + c44bb07 commit e15677b
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 91 deletions.
4 changes: 3 additions & 1 deletion lib/components/dataGrid/AdministrationHeader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class AdministrationHeader<T extends IPlutoRowModel> extends StatefulWidget {
localeText: DataGridHelper.getPlutoLocaleFromLangCode(langCode),
style: ThemeConfig.isDarkMode(context) ? PlutoGridStyleConfig.dark(
rowHeight: 36,
cellColorInReadOnlyState: Colors.white70
cellColorInReadOnlyState: Colors.white24,
cellTextStyle: TextStyle(color: ThemeConfig.blackColor(context)),
columnTextStyle: TextStyle(color: ThemeConfig.blackColor(context)),
) : PlutoGridStyleConfig(
rowHeight: 36,
cellColorInReadOnlyState: Colors.white70
Expand Down
156 changes: 77 additions & 79 deletions lib/components/dataGrid/SingleTableDataGrid.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fstapp/themeConfig.dart';
import 'package:pluto_grid_plus/pluto_grid_plus.dart';

import 'DataGridAction.dart';
Expand Down Expand Up @@ -30,89 +31,86 @@ class SingleTableDataGrid<T extends IPlutoRowModel> {
SingleTableDataGrid(this.context, this.loadData, this.fromPlutoJson, this.firstColumnType, this.idColumn, {required this.columns, this.headerChildren, this.actionsExtended});
DataGrid() {
return Container(
padding: const EdgeInsets.all(6),
child: Container(
padding: const EdgeInsets.all(3),
decoration: const BoxDecoration(
border: null
),
child: PlutoGrid(
columns: columns,
rows: rows,
onChanged: (PlutoGridOnChangedEvent event) {

if(event.row.state == PlutoRowState.updated)
padding: const EdgeInsets.all(3),
decoration: BoxDecoration(
color: ThemeConfig.whiteColor(context),
),
child: PlutoGrid(
columns: columns,
rows: rows,
onChanged: (PlutoGridOnChangedEvent event) {

if(event.row.state == PlutoRowState.updated)
{
if(event.row.cells[idColumn]?.value != -1)
{
if(event.row.cells[idColumn]?.value != -1)
deletedRows.remove(event.row);
if(!newRows.contains(event.row))
{
deletedRows.remove(event.row);
if(!newRows.contains(event.row))
{
updatedRows.add(event.row);
}

// todo add check for real value change
// bool isAnythingChanged = false;
// var oldRow = stateManager.refRows.originalList.firstWhere((r)=>r.key == event.row.key);
//
// for(var c in event.row.cells.entries)
// {
// if(c.value != oldRow.cells[c.key])
// {
// isAnythingChanged = true;
// break;
// }
// }
//
// if(isAnythingChanged)
// {
// updatedRows.add(event.row);
// }
// else
// {
// updatedRows.remove(event.row);
// }
updatedRows.add(event.row);
}

// todo add check for real value change
// bool isAnythingChanged = false;
// var oldRow = stateManager.refRows.originalList.firstWhere((r)=>r.key == event.row.key);
//
// for(var c in event.row.cells.entries)
// {
// if(c.value != oldRow.cells[c.key])
// {
// isAnythingChanged = true;
// break;
// }
// }
//
// if(isAnythingChanged)
// {
// updatedRows.add(event.row);
// }
// else
// {
// updatedRows.remove(event.row);
// }
}

stateManager.notifyListeners();
},
onLoaded: (PlutoGridOnLoadedEvent event) {
stateManager = event.stateManager;
event.stateManager.setSelectingMode(PlutoGridSelectingMode.row);
event.stateManager.setShowColumnFilter(true);
reloadData();
},
rowColorCallback: (rowContext){
var row = deletedRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.redAccent.withOpacity(0.3);
}

row = updatedRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.orangeAccent.withOpacity(0.3);
}

row = newRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.orangeAccent.withOpacity(0.3);
}
return Colors.transparent;
},
createHeader: (stateManager) =>
AdministrationHeader(
stateManager: stateManager,
fromPlutoJson: fromPlutoJson,
loadData: reloadData,
headerChildren: headerChildren,
saveExtended: actionsExtended,
dataGrid: this),
configuration: AdministrationHeader.defaultPlutoGridConfiguration(context, context.locale.languageCode),
),
}

stateManager.notifyListeners();
},
onLoaded: (PlutoGridOnLoadedEvent event) {
stateManager = event.stateManager;
event.stateManager.setSelectingMode(PlutoGridSelectingMode.row);
event.stateManager.setShowColumnFilter(true);
reloadData();
},
rowColorCallback: (rowContext){
var row = deletedRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.redAccent.withOpacity(0.3);
}

row = updatedRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.orangeAccent.withOpacity(0.3);
}

row = newRows.firstWhereOrNull((element) => element.key == rowContext.row.key);
if(row != null)
{
return Colors.orangeAccent.withOpacity(0.3);
}
return Colors.transparent;
},
createHeader: (stateManager) =>
AdministrationHeader(
stateManager: stateManager,
fromPlutoJson: fromPlutoJson,
loadData: reloadData,
headerChildren: headerChildren,
saveExtended: actionsExtended,
dataGrid: this),
configuration: AdministrationHeader.defaultPlutoGridConfiguration(context, context.locale.languageCode),
),
);
}
Expand Down
15 changes: 8 additions & 7 deletions lib/pages/CheckPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class _CheckPageState extends State<CheckPage> {
Text(
_scannedUser!.toFullNameString(),
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold,
),
Expand All @@ -136,8 +137,8 @@ class _CheckPageState extends State<CheckPage> {
],
),
if (_scannedUser!.companionParent == null) ...[
Text(_scannedUser!.email!),
Text(UserInfoModel.sexToLocale(_scannedUser!.sex)),
Text(_scannedUser!.email!, style: TextStyle(color: Colors.black),),
Text(UserInfoModel.sexToLocale(_scannedUser!.sex,), style: TextStyle(color: Colors.black)),
if (_scannedUser!.companions != null) ...[
const SizedBox(height: 16),
Text("${'Signed in companions'.tr()}:"),
Expand Down Expand Up @@ -170,7 +171,7 @@ class _CheckPageState extends State<CheckPage> {
const minChildSize = 0.25;
const maxChildSize = 0.88;
return Scaffold(
backgroundColor: _scannedUser == null ? Colors.grey[200] : getResultColor(_scanState),
backgroundColor: _scannedUser == null ? ThemeConfig.grey200(context) : getResultColor(_scanState),
body: SafeArea(
child: Stack(
children: [
Expand Down Expand Up @@ -250,8 +251,8 @@ class _CheckPageState extends State<CheckPage> {
curve: Curves.easeInOut);
},
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
decoration: BoxDecoration(
color: ThemeConfig.whiteColor(context),
borderRadius:
BorderRadius.vertical(top: Radius.circular(16)),
),
Expand All @@ -266,7 +267,7 @@ class _CheckPageState extends State<CheckPage> {
width: 60,
margin: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
color: Colors.grey[300],
color: ThemeConfig.grey380(context),
borderRadius: BorderRadius.circular(3),
),
),
Expand Down Expand Up @@ -295,7 +296,7 @@ class _CheckPageState extends State<CheckPage> {
horizontal: 10, vertical: 5),
child: Container(
decoration: BoxDecoration(
color: Colors.grey[200],
color: ThemeConfig.grey200(context),
borderRadius:
BorderRadius.circular(12),
),
Expand Down
10 changes: 6 additions & 4 deletions lib/pages/UserPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _UserPageState extends State<UserPage> {
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: ThemeConfig.seed1,
color: ThemeConfig.blackColor(context),
),
onPressed: () {
RouterService.goBack(context);
Expand All @@ -80,7 +80,7 @@ class _UserPageState extends State<UserPage> {
},
icon: Icon(
Icons.download,
color: ThemeConfig.seed1,
color: ThemeConfig.blackColor(context),
),
),
),
Expand All @@ -102,6 +102,7 @@ class _UserPageState extends State<UserPage> {
Text(
"[$eventName]",
style: const TextStyle(
color: Colors.black,
fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
Expand All @@ -114,6 +115,7 @@ class _UserPageState extends State<UserPage> {
Text(
"[$name]",
style: const TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.bold,
),
Expand Down Expand Up @@ -193,9 +195,9 @@ class _UserPageState extends State<UserPage> {
itemBuilder: (context, index) {
if (index == 0) {
return ListTile(
title: const Text(
title: Text(
"Companions",
style: TextStyle(fontWeight: FontWeight.bold),
style: TextStyle(color: ThemeConfig.blackColor(context), fontWeight: FontWeight.bold),
).tr(),
);
}
Expand Down

0 comments on commit e15677b

Please sign in to comment.