diff --git a/lib/Components/rounded_input_field.dart b/lib/Components/rounded_input_field.dart index 75e5c07..cdfe94b 100644 --- a/lib/Components/rounded_input_field.dart +++ b/lib/Components/rounded_input_field.dart @@ -10,6 +10,7 @@ class RoundedInputField extends StatelessWidget { final Color color, textColor, iconColor; final int maxLength; final bool isEmail; + final double fontSize; const RoundedInputField({ Key key, this.hintText, @@ -20,7 +21,8 @@ class RoundedInputField extends StatelessWidget { this.iconColor = kPrimaryColor, this.onChanged, this.maxLength, // 50 - this.isEmail = false + this.isEmail = false, + this.fontSize = 20, }) : super(key: key); @override @@ -33,14 +35,14 @@ class RoundedInputField extends StatelessWidget { cursorColor: textColor, maxLength: maxLength, keyboardType: isEmail ? TextInputType.emailAddress : TextInputType.text, - style: TextStyle(fontSize: 20, color: textColor), + style: TextStyle(fontSize: fontSize, color: textColor), decoration: InputDecoration( icon: icon != null ? Icon( icon, color: iconColor, ): null, hintText: hintText, - hintStyle: TextStyle(fontSize: 20.0, color: textColor), + hintStyle: TextStyle(fontSize: fontSize, color: textColor), border: InputBorder.none, ) ), diff --git a/lib/Components/string_input_container.dart b/lib/Components/string_input_container.dart index b4ea2be..8ff1b82 100644 --- a/lib/Components/string_input_container.dart +++ b/lib/Components/string_input_container.dart @@ -10,6 +10,8 @@ class StringInputContainer extends StatelessWidget { final bool isUrl; final bool isSmall; final int maxLength; + final double fontSize; + final double fontSizeText; const StringInputContainer({ Key key, this.color = kSecond, @@ -19,6 +21,8 @@ class StringInputContainer extends StatelessWidget { this.isUrl = false, this.isSmall = false, this.maxLength = 50, + this.fontSize = 25, + this.fontSizeText = 20, }) : super(key: key); @override @@ -29,7 +33,7 @@ class StringInputContainer extends StatelessWidget { children: [ Align( alignment: AlignmentDirectional.centerStart, - child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) + child: Text(label, style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300)) ), Padding( padding: const EdgeInsets.all(10.0), @@ -38,6 +42,7 @@ class StringInputContainer extends StatelessWidget { child: RoundedInputField( color: color, textColor: kBlack, + fontSize: fontSizeText, initialValue: initialValue, onChanged: onChanged, maxLength: maxLength, diff --git a/lib/Screens/Configurations/listView_card_section.dart b/lib/Screens/Configurations/listView_card_section.dart index e133903..56ddb25 100644 --- a/lib/Screens/Configurations/listView_card_section.dart +++ b/lib/Screens/Configurations/listView_card_section.dart @@ -33,24 +33,13 @@ class _ListViewCardSectionsState extends State { Size size = MediaQuery.of(context).size; return Card( - margin: EdgeInsets.all(4), - child: Center( - child: Stack( - children: [ - InkWell( - onTap: () { - widget.onSelect(widget.sections[widget.index]); - }, - child: Container( - width: 250, - height: 200, - child: Padding( - padding: const EdgeInsets.only(right: 30.0), - child: getElement(widget.index, widget.sections[widget.index], size, appContext) - ), - ), - ), - ], + child: InkWell( + onTap: () { + widget.onSelect(widget.sections[widget.index]); + }, + child: Center( + //padding: const EdgeInsets.only(right: 30.0), + child: getElement(widget.index, widget.sections[widget.index], size, appContext) ), ), ); @@ -58,9 +47,11 @@ class _ListViewCardSectionsState extends State { getElement(int index, SectionDTO sectionDTO, Size size, AppContext appContext) { return Container( + width: 150, + height: 150, decoration: boxDecoration(sectionDTO, appContext), - padding: const EdgeInsets.all(15), - margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + padding: const EdgeInsets.all(5), + //margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), child: Align( alignment: Alignment.center, child: getDetails(sectionDTO, size), diff --git a/lib/Screens/Configurations/section_reorderList.dart b/lib/Screens/Configurations/section_reorderList.dart index bc4158b..e37f6b7 100644 --- a/lib/Screens/Configurations/section_reorderList.dart +++ b/lib/Screens/Configurations/section_reorderList.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/listView_card_section.dart'; import 'package:manager_app/Screens/Configurations/new_section_popup.dart'; @@ -25,6 +26,7 @@ class SectionReorderList extends StatefulWidget { class _SectionReorderListState extends State { List sections; + String filterSearch = ''; @override void initState() { @@ -55,25 +57,27 @@ class _SectionReorderListState extends State { @override Widget build(BuildContext context) { final appContext = Provider.of(context); - //Size size = MediaQuery.of(context).size; + Size size = MediaQuery.of(context).size; return Stack( children: [ Padding( padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0, top: 15.0), - child: ReorderableListView( - onReorder: _onReorder, - scrollDirection: Axis.horizontal, - padding: const EdgeInsets.symmetric(vertical: 20.0), - children: List.generate( - sections.length, - (index) { + child: Container( + height: size.height*0.3, + child: ReorderableListView.builder( + itemCount: sections.length, + onReorder: _onReorder, + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(vertical: 20.0), + itemBuilder: (context, index) { + //final String productName = _products[index]; return ListViewCardSections( sections, index, Key('$index'), appContext, - (section) { + (section) { setState(() { ManagerAppContext managerAppContext = appContext.getContext(); managerAppContext.selectedSection = section; @@ -82,6 +86,24 @@ class _SectionReorderListState extends State { } ); }, + /*children: List.generate( + sections.length, + (index) { + return ListViewCardSections( + sections, + index, + Key('$index'), + appContext, + (section) { + setState(() { + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedSection = section; + appContext.setContext(managerAppContext); + }); + } + ); + }, + ),*/ ), ), ), @@ -93,6 +115,22 @@ class _SectionReorderListState extends State { style: TextStyle(fontSize: 15), ), ), + Positioned( + bottom: -20, + left: 10, + child: StringInputContainer( + label: "Recherche:", + isSmall: true, + fontSize: 15, + fontSizeText: 15, + onChanged: (String value) { + setState(() { + filterSearch = value; + filterResource(); + }); + }, + ), + ), Positioned( bottom: 10, right: 10, @@ -127,4 +165,8 @@ class _SectionReorderListState extends State { ], ); } + + void filterResource() { + sections = filterSearch.isEmpty ? widget.sectionsIn: widget.sectionsIn.where((SectionDTO section) => section.label.toUpperCase().contains(filterSearch.toUpperCase())).toList(); + } }