Change reorder section size + add search
This commit is contained in:
parent
98e066c712
commit
e3beb6c7f8
@ -10,6 +10,7 @@ class RoundedInputField extends StatelessWidget {
|
|||||||
final Color color, textColor, iconColor;
|
final Color color, textColor, iconColor;
|
||||||
final int maxLength;
|
final int maxLength;
|
||||||
final bool isEmail;
|
final bool isEmail;
|
||||||
|
final double fontSize;
|
||||||
const RoundedInputField({
|
const RoundedInputField({
|
||||||
Key key,
|
Key key,
|
||||||
this.hintText,
|
this.hintText,
|
||||||
@ -20,7 +21,8 @@ class RoundedInputField extends StatelessWidget {
|
|||||||
this.iconColor = kPrimaryColor,
|
this.iconColor = kPrimaryColor,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.maxLength, // 50
|
this.maxLength, // 50
|
||||||
this.isEmail = false
|
this.isEmail = false,
|
||||||
|
this.fontSize = 20,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -33,14 +35,14 @@ class RoundedInputField extends StatelessWidget {
|
|||||||
cursorColor: textColor,
|
cursorColor: textColor,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
keyboardType: isEmail ? TextInputType.emailAddress : TextInputType.text,
|
keyboardType: isEmail ? TextInputType.emailAddress : TextInputType.text,
|
||||||
style: TextStyle(fontSize: 20, color: textColor),
|
style: TextStyle(fontSize: fontSize, color: textColor),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
icon: icon != null ? Icon(
|
icon: icon != null ? Icon(
|
||||||
icon,
|
icon,
|
||||||
color: iconColor,
|
color: iconColor,
|
||||||
): null,
|
): null,
|
||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
hintStyle: TextStyle(fontSize: 20.0, color: textColor),
|
hintStyle: TextStyle(fontSize: fontSize, color: textColor),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -10,6 +10,8 @@ class StringInputContainer extends StatelessWidget {
|
|||||||
final bool isUrl;
|
final bool isUrl;
|
||||||
final bool isSmall;
|
final bool isSmall;
|
||||||
final int maxLength;
|
final int maxLength;
|
||||||
|
final double fontSize;
|
||||||
|
final double fontSizeText;
|
||||||
const StringInputContainer({
|
const StringInputContainer({
|
||||||
Key key,
|
Key key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
@ -19,6 +21,8 @@ class StringInputContainer extends StatelessWidget {
|
|||||||
this.isUrl = false,
|
this.isUrl = false,
|
||||||
this.isSmall = false,
|
this.isSmall = false,
|
||||||
this.maxLength = 50,
|
this.maxLength = 50,
|
||||||
|
this.fontSize = 25,
|
||||||
|
this.fontSizeText = 20,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -29,7 +33,7 @@ class StringInputContainer extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
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(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
@ -38,6 +42,7 @@ class StringInputContainer extends StatelessWidget {
|
|||||||
child: RoundedInputField(
|
child: RoundedInputField(
|
||||||
color: color,
|
color: color,
|
||||||
textColor: kBlack,
|
textColor: kBlack,
|
||||||
|
fontSize: fontSizeText,
|
||||||
initialValue: initialValue,
|
initialValue: initialValue,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
|
|||||||
@ -33,24 +33,13 @@ class _ListViewCardSectionsState extends State<ListViewCardSections> {
|
|||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
margin: EdgeInsets.all(4),
|
child: InkWell(
|
||||||
child: Center(
|
onTap: () {
|
||||||
child: Stack(
|
widget.onSelect(widget.sections[widget.index]);
|
||||||
children: [
|
},
|
||||||
InkWell(
|
child: Center(
|
||||||
onTap: () {
|
//padding: const EdgeInsets.only(right: 30.0),
|
||||||
widget.onSelect(widget.sections[widget.index]);
|
child: getElement(widget.index, widget.sections[widget.index], size, appContext)
|
||||||
},
|
|
||||||
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)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -58,9 +47,11 @@ class _ListViewCardSectionsState extends State<ListViewCardSections> {
|
|||||||
|
|
||||||
getElement(int index, SectionDTO sectionDTO, Size size, AppContext appContext) {
|
getElement(int index, SectionDTO sectionDTO, Size size, AppContext appContext) {
|
||||||
return Container(
|
return Container(
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
decoration: boxDecoration(sectionDTO, appContext),
|
decoration: boxDecoration(sectionDTO, appContext),
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(5),
|
||||||
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
//margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: getDetails(sectionDTO, size),
|
child: getDetails(sectionDTO, size),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.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/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/listView_card_section.dart';
|
import 'package:manager_app/Screens/Configurations/listView_card_section.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/new_section_popup.dart';
|
import 'package:manager_app/Screens/Configurations/new_section_popup.dart';
|
||||||
@ -25,6 +26,7 @@ class SectionReorderList extends StatefulWidget {
|
|||||||
|
|
||||||
class _SectionReorderListState extends State<SectionReorderList> {
|
class _SectionReorderListState extends State<SectionReorderList> {
|
||||||
List<SectionDTO> sections;
|
List<SectionDTO> sections;
|
||||||
|
String filterSearch = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -55,25 +57,27 @@ class _SectionReorderListState extends State<SectionReorderList> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
//Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0, top: 15.0),
|
padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0, top: 15.0),
|
||||||
child: ReorderableListView(
|
child: Container(
|
||||||
onReorder: _onReorder,
|
height: size.height*0.3,
|
||||||
scrollDirection: Axis.horizontal,
|
child: ReorderableListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
itemCount: sections.length,
|
||||||
children: List.generate(
|
onReorder: _onReorder,
|
||||||
sections.length,
|
scrollDirection: Axis.horizontal,
|
||||||
(index) {
|
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
//final String productName = _products[index];
|
||||||
return ListViewCardSections(
|
return ListViewCardSections(
|
||||||
sections,
|
sections,
|
||||||
index,
|
index,
|
||||||
Key('$index'),
|
Key('$index'),
|
||||||
appContext,
|
appContext,
|
||||||
(section) {
|
(section) {
|
||||||
setState(() {
|
setState(() {
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
managerAppContext.selectedSection = section;
|
managerAppContext.selectedSection = section;
|
||||||
@ -82,6 +86,24 @@ class _SectionReorderListState extends State<SectionReorderList> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
/*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<SectionReorderList> {
|
|||||||
style: TextStyle(fontSize: 15),
|
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(
|
Positioned(
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
right: 10,
|
right: 10,
|
||||||
@ -127,4 +165,8 @@ class _SectionReorderListState extends State<SectionReorderList> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterResource() {
|
||||||
|
sections = filterSearch.isEmpty ? widget.sectionsIn: widget.sectionsIn.where((SectionDTO section) => section.label.toUpperCase().contains(filterSearch.toUpperCase())).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user