resource select, show only image when select
This commit is contained in:
parent
b5387880b1
commit
5651022cce
@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/fetch_resource_icon.dart';
|
||||
import 'package:manager_app/Components/multi_select_container.dart';
|
||||
import 'package:manager_app/Components/string_input_container.dart';
|
||||
import 'package:manager_app/Screens/Resources/new_resource_popup.dart';
|
||||
import 'package:manager_app/Screens/Resources/show_resource_popup.dart';
|
||||
import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
@ -13,10 +11,12 @@ import 'package:provider/provider.dart';
|
||||
class ResourceBodyGrid extends StatefulWidget {
|
||||
final List<ResourceDTO> resources; //return ResourceDTO
|
||||
final Function onSelect;
|
||||
final bool isImage;
|
||||
const ResourceBodyGrid({
|
||||
Key key,
|
||||
this.resources,
|
||||
this.onSelect,
|
||||
this.isImage,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -67,7 +67,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
|
||||
child: MultiSelectContainer(
|
||||
label: "Type :",
|
||||
initialValue: filterType,
|
||||
values: resource_types,
|
||||
values: widget.isImage ? resource_types.where((type) => type != "video" && type != "video url").toList(): resource_types,
|
||||
isMultiple: true,
|
||||
onChanged: (result) {
|
||||
setState(() {
|
||||
|
||||
@ -15,7 +15,7 @@ class ResourcesScreen extends StatefulWidget {
|
||||
final bool isImage;
|
||||
const ResourcesScreen({
|
||||
Key key,
|
||||
this.isImage,
|
||||
this.isImage = false,
|
||||
this.onGetResult,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -37,9 +37,7 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
||||
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);
|
||||
return ResourceBodyGrid(resources: tempOutput, isImage: widget.isImage, onSelect: (value) {
|
||||
if (widget.onGetResult == null) {
|
||||
// Main screen
|
||||
if (value.id == null) {
|
||||
|
||||
@ -18,7 +18,7 @@ showSelectResourceModal (String text, Function onGetResult, int maxLines, bool o
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: size.width * 0.6,
|
||||
width: size.width * 0.7,
|
||||
height: size.height * 0.75,
|
||||
child: ResourcesScreen(
|
||||
onGetResult: (ResourceDTO resource) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user