Search fix + fix pdf generation with special character

This commit is contained in:
Fransolet Thomas 2023-03-10 19:25:22 +01:00
parent 2056fc23fb
commit 11f5e2860f
5 changed files with 14 additions and 3 deletions

View File

@ -23,7 +23,7 @@ class PDFHelper {
child:
pw.Column(
children: [
pw.Text(section.label), //style: pw.TextStyle(font: ttf, fontSize: 30)
pw.Text(section.label.replaceAll(RegExp("[^A-Za-z0-9---():!éàèëêäâç' ]"), '')), //style: pw.TextStyle(font: ttf, fontSize: 30)
pw.Padding(padding: const pw.EdgeInsets.only(top: 20)),
pw.BarcodeWidget(
data: section.id,

View File

@ -1,3 +1,4 @@
import 'package:diacritic/diacritic.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/string_input_container.dart';
import 'package:manager_app/Models/managerContext.dart';
@ -172,6 +173,6 @@ class _SectionReorderListState extends State<SectionReorderList> {
}
void filterResource() {
sections = filterSearch.isEmpty ? widget.sectionsIn: widget.sectionsIn.where((SectionDTO section) => section.label.toUpperCase().contains(filterSearch.toUpperCase())).toList();
sections = filterSearch.isEmpty ? widget.sectionsIn: widget.sectionsIn.where((SectionDTO section) => removeDiacritics(section.label.toUpperCase()).contains(removeDiacritics(filterSearch.toUpperCase()))).toList();
}
}

View File

@ -7,6 +7,7 @@ import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:manager_api_new/api.dart';
import 'package:provider/provider.dart';
import 'package:diacritic/diacritic.dart';
class ResourceBodyGrid extends StatefulWidget {
final List<ResourceDTO> resources; //return ResourceDTO
@ -182,7 +183,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
}
void filterResource() {
resourcesToShow = filterSearch.isEmpty ? widget.resources: widget.resources.where((ResourceDTO resource) => resource.id == null || resource.label.toUpperCase().contains(filterSearch.toUpperCase())).toList();
resourcesToShow = filterSearch.isEmpty ? widget.resources: widget.resources.where((ResourceDTO resource) => resource.id == null || removeDiacritics(resource.label.toUpperCase()).contains(removeDiacritics(filterSearch.toUpperCase()))).toList();
var getTypesInSelected = resource_types.where((ft) => selectedTypes.contains(ft.label)).map((rt) => rt.type).toList();
resourcesToShow = resourcesToShow.where((resource) => resource.id == null || getTypesInSelected.contains(resource.type)).toList();
}

View File

@ -217,6 +217,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.4"
diacritic:
dependency: "direct main"
description:
name: diacritic
sha256: c09a420e737dc036122121fea9f774767e95068f34a17894ee9db30c5bda3075
url: "https://pub.dev"
source: hosted
version: "0.1.3"
drag_and_drop_lists:
dependency: "direct main"
description:

View File

@ -51,6 +51,7 @@ dependencies:
# path: plugins/window_size
# ref: 927f8cbc09b35d85245c095f2db8df9b186f6618
password_credential: ^0.3.1
diacritic: ^0.1.3
manager_api_new:
path: manager_api_new