Resolve renderflex overflowed for resources list

This commit is contained in:
Thomas Fransolet 2021-05-25 19:15:56 +02:00
parent ab833808a4
commit 019402b4c0
2 changed files with 49 additions and 54 deletions

View File

@ -88,31 +88,28 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
)
],
),
Container(
height: size.height *0.85,
child: SingleChildScrollView(
child: GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return
InkWell(
onTap: () {
widget.onSelect(resourcesToShow[index]);
},
child: Container(
decoration: boxDecoration(data[index], appContext),
padding: const EdgeInsets.all(15),
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
child: Align(
alignment: Alignment.center,
child: getElement(data[index], size, appContext)
),
Expanded(
child: GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return
InkWell(
onTap: () {
widget.onSelect(resourcesToShow[index]);
},
child: Container(
decoration: boxDecoration(data[index], appContext),
padding: const EdgeInsets.all(15),
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
child: Align(
alignment: Alignment.center,
child: getElement(data[index], size, appContext)
),
);
}
),
),
);
}
),
),
],

View File

@ -31,39 +31,37 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return Container(
child: FutureBuilder(
future: getResources(widget.onGetResult, widget.isImage, appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
// tempOutput.add(ResourceDTO(id: null));
return ResourceBodyGrid(resources: tempOutput, onSelect: (value) {
print("result parent");
print(value);
if (widget.onGetResult == null) {
// Main screen
if (value.id == null) {
showNewResource(appContext, context);
} else {
showResource(value, appContext, context, size);
}
return FutureBuilder(
future: getResources(widget.onGetResult, widget.isImage, appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
// tempOutput.add(ResourceDTO(id: null));
return ResourceBodyGrid(resources: tempOutput, onSelect: (value) {
print("result parent");
print(value);
if (widget.onGetResult == null) {
// Main screen
if (value.id == null) {
showNewResource(appContext, context);
} else {
if (value.id == null) {
showNewResource(appContext, context);
} else {
// Result for select modal
widget.onGetResult(value);
}
showResource(value, appContext, context, size);
}
},);//bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
} else {
if (value.id == null) {
showNewResource(appContext, context);
} else {
// Result for select modal
widget.onGetResult(value);
}
}
},);//bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
),
}
);
}
}