Layout menu (translation as horizontal list) + add filter in resource screen (name)

This commit is contained in:
Thomas Fransolet 2021-05-25 19:07:44 +02:00
parent 171fce5e24
commit ab833808a4
8 changed files with 420 additions and 316 deletions

View File

@ -48,7 +48,7 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: size.width *0.10,
width: size.width *0.08,
child: InkWell(
onTap: () {
showSelectResourceModal(

View File

@ -7,6 +7,7 @@ class TextFormInputContainer extends StatelessWidget {
final String label;
final String initialValue;
final bool isTitle;
final int maxLines;
final ValueChanged<String> onChanged;
const TextFormInputContainer({
Key key,
@ -14,6 +15,7 @@ class TextFormInputContainer extends StatelessWidget {
this.label,
this.initialValue,
this.isTitle,
this.maxLines = 5,
this.onChanged
}) : super(key: key);
@ -42,7 +44,7 @@ class TextFormInputContainer extends StatelessWidget {
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
minLines: 1,
maxLines: 5,
maxLines: maxLines,
initialValue: initialValue,
onChanged: onChanged,
maxLength: isTitle ? 50 : 2000,

View File

@ -29,6 +29,7 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext
children: [
Text("Modifier sous section", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -48,34 +49,14 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext
subSectionDTO.imageId = resource.id;
},
),
/*Column(
children: [
StringInputContainer(
label: "Latitude :",
initialValue: geoPointDTO.latitude,
onChanged: (value) {
geoPointDTO.latitude = value;
},
),
StringInputContainer(
label: "Longitude :",
initialValue: geoPointDTO.longitude,
onChanged: (value) {
geoPointDTO.longitude = value;
},
)
],
)*/
],
),
Container(
height: size.height * 0.33,
width: double.infinity,
color: Colors.lightBlue,
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: getTranslations(context, appContext, subSectionDTO),
),
child: ListView(
scrollDirection: Axis.horizontal,
children: getTranslations(context, appContext, subSectionDTO),
),
),
Container(
@ -190,51 +171,54 @@ getTranslations(BuildContext context, AppContext appContext, SectionDTO subSecti
ManagerAppContext managerAppContext = appContext.getContext();
for(var language in managerAppContext.selectedConfiguration.languages) {
translations.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width *0.05,
height: MediaQuery.of(context).size.height *0.2,
decoration: BoxDecoration(
border: Border(
right: BorderSide(width: 1.5, color: kSecond),
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width *0.05,
height: MediaQuery.of(context).size.height *0.2,
decoration: BoxDecoration(
border: Border(
right: BorderSide(width: 1.5, color: kSecond),
),
),
child: Center(child: AutoSizeText(language.toUpperCase()))
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Titre:",
color: kWhite,
isTitle: true,
maxLines: 1,
initialValue: subSectionDTO.title.where((element) => element.language == language).first.value,
onChanged: (value) {
subSectionDTO.title.where((element) => element.language == language).first.value = value;
},
),
TextFormInputContainer(
label: "Description:",
color: kWhite,
isTitle: false,
initialValue: subSectionDTO.description.where((element) => element.language == language).first.value,
onChanged: (value) {
subSectionDTO.description.where((element) => element.language == language).first.value = value;
},
),
],
),
),
child: Center(child: AutoSizeText(language.toUpperCase()))
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Titre:",
color: kWhite,
isTitle: true,
initialValue: subSectionDTO.title.where((element) => element.language == language).first.value,
onChanged: (value) {
subSectionDTO.title.where((element) => element.language == language).first.value = value;
},
),
TextFormInputContainer(
label: "Description:",
color: kWhite,
isTitle: false,
initialValue: subSectionDTO.description.where((element) => element.language == language).first.value,
onChanged: (value) {
subSectionDTO.description.where((element) => element.language == language).first.value = value;
},
),
],
),
),
)
],
)
],
),
),
)
);

View File

@ -36,19 +36,17 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return SingleChildScrollView(
child: FutureBuilder(
future: getSection(widget.id, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return bodySection(snapshot.data, size, appContext, context);
} 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')));
}
return FutureBuilder(
future: getSection(widget.id, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return bodySection(snapshot.data, size, appContext, context);
} 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')));
}
),
}
);
}
@ -189,7 +187,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
),
),// FIELDS SECTION
Container(
height: size.height * 0.45,
height: size.height * 0.39,
width: size.width * 0.8,
child: Padding(
padding: const EdgeInsets.all(10.0),

View File

@ -34,19 +34,17 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return Container(
child: FutureBuilder(
future: getConfiguration(this.widget, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return bodyConfiguration(snapshot.data, size, appContext, context);
} 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')));
}
return FutureBuilder(
future: getConfiguration(this.widget, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return bodyConfiguration(snapshot.data, size, appContext, context);
} 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')));
}
),
}
);
}
@ -55,137 +53,148 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(
alignment: AlignmentDirectional.bottomStart,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(configurationDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
Padding(
padding: const EdgeInsets.all(5.0),
child: Text(DateFormat('dd/MM/yyyy').format(configurationDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
),
],
),
)
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: InkWell(
onTap: () {
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration = null;
appContext.setContext(managerAppContext);
},
child: Container(
child: Icon(
Icons.arrow_back,
color: kPrimaryColor,
size: 50.0,
)
)
),
//height: size.height *0.12,
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(
alignment: AlignmentDirectional.bottomStart,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(configurationDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
Padding(
padding: const EdgeInsets.all(5.0),
child: Text(DateFormat('dd/MM/yyyy').format(configurationDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
),
],
),
)
),
)
],
Padding(
padding: const EdgeInsets.all(10.0),
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: InkWell(
onTap: () {
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration = null;
appContext.setContext(managerAppContext);
},
child: Container(
child: Icon(
Icons.arrow_back,
color: kPrimaryColor,
size: 50.0,
)
)
),
),
)
],
),
),
), // TITLE
Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StringInputContainer(
label: "Nom :",
initialValue: configurationDTO.label,
onChanged: (value) {
configurationDTO.label = value;
},
),
MultiSelectContainer(
label: "Langues :",
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
values: languages,
isMultiple: true,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
configurationDTO.languages = tempOutput;
print(configurationDTO.languages);
},
),
],
//height: size.height *0.76,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StringInputContainer(
label: "Nom :",
initialValue: configurationDTO.label,
onChanged: (value) {
configurationDTO.label = value;
},
),
MultiSelectContainer(
label: "Langues :",
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
values: languages,
isMultiple: true,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
configurationDTO.languages = tempOutput;
print(configurationDTO.languages);
},
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ColorPickerInputContainer(
label: "Couleur principal :",
color: configurationDTO.primaryColor,
onChanged: (value) {
configurationDTO.primaryColor = value;
},
),
ColorPickerInputContainer(
label: "Couleur secondaire :",
color: configurationDTO.secondaryColor,
onChanged: (value) {
configurationDTO.secondaryColor = value;
},
),
],
)
],
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0),
border: Border.all(width: 0.5, color: kSecond)
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ColorPickerInputContainer(
label: "Couleur principal :",
color: configurationDTO.primaryColor,
onChanged: (value) {
configurationDTO.primaryColor = value;
},
),
ColorPickerInputContainer(
label: "Couleur secondaire :",
color: configurationDTO.secondaryColor,
onChanged: (value) {
configurationDTO.secondaryColor = value;
},
),
],
)
],
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0),
border: Border.all(width: 0.5, color: kSecond)
),
child: FutureBuilder(
future: getSections(configurationDTO, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<SectionDTO>.from(snapshot.data).where((section) => !section.isSubSection).toList();
tempOutput.add(SectionDTO(id: null));
return bodyGrid(configurationDTO, 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')));
child: FutureBuilder(
future: getSections(configurationDTO, appContext.getContext().clientAPI),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<SectionDTO>.from(snapshot.data).where((section) => !section.isSubSection).toList();
tempOutput.add(SectionDTO(id: null));
return bodyGrid(configurationDTO, 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')));
}
}
}
),
),
),
),
],
],
),
),
),
),
),// FIELDS SECTION
getButtons(configurationDTO, appContext),
Container(
//height: size.height *0.09,
child: SingleChildScrollView(
child: getButtons(configurationDTO, appContext)
)
)
],
);
}

View File

@ -34,7 +34,8 @@ class _ConfigurationsScreenState extends State<ConfigurationsScreen> {
if (managerAppContext.selectedConfiguration != null) {
return ConfigurationDetailScreen(id: managerAppContext.selectedConfiguration.id);
} else {
return Container(
return Align(
alignment: AlignmentDirectional.topCenter,
child: FutureBuilder(
future: getConfigurations(appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {

View File

@ -0,0 +1,189 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/fetch_resource_icon.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';
import 'package:provider/provider.dart';
class ResourceBodyGrid extends StatefulWidget {
final List<ResourceDTO> resources; //return ResourceDTO
final Function onSelect;
const ResourceBodyGrid({
Key key,
this.resources,
this.onSelect,
}) : super(key: key);
@override
_ResourceBodyGridState createState() => _ResourceBodyGridState();
}
class _ResourceBodyGridState extends State<ResourceBodyGrid> {
String filter;
List<ResourceDTO> resourcesToShow;
@override
void initState() {
resourcesToShow = widget.resources;
super.initState();
}
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return bodyGrid(resourcesToShow, size, appContext);
}
Widget bodyGrid(data, Size size, AppContext appContext) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: StringInputContainer(
label: "Recherche:",
onChanged: (String value) {
setState(() {
resourcesToShow = value.isEmpty ? widget.resources: widget.resources.where((ResourceDTO resource) => resource.label.toUpperCase().contains(value.toUpperCase())).toList();
});
},
),
),
InkWell(
onTap: () {
widget.onSelect(ResourceDTO(id: null));
},
child: Container(
height: size.height *0.08,
width: size.height *0.08,
decoration: BoxDecoration(
color: Colors.lightGreen,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0),
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
),
child:
Padding(
padding: const EdgeInsets.all(10.0),
child: LayoutBuilder(builder: (context, constraint) {
return new Icon(Icons.add, size: constraint.biggest.height, color: kTextLightColor);
}),
),
),
)
],
),
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)
),
),
);
}
),
),
),
],
);
}
getElement(ResourceDTO resource, Size size, AppContext appContext) {
if (resource.id != null) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
height: size.width *0.01,
),
Align(
alignment: Alignment.center,
child: AutoSizeText(
resource.label == null ? "" : resource.label,
style: new TextStyle(fontSize: 20),
maxLines: 1,
),
),
Align(
alignment: Alignment.bottomRight,
child: Icon(
getResourceIcon(resource.type),
color: kPrimaryColor,
size: 25,
),
),
],
);
} else {
return Icon(
Icons.add,
color: kTextLightColor,
size: 80.0,
);
}
}
}
boxDecoration(dynamic resourceDetailDTO, appContext) {
return BoxDecoration(
color: resourceDetailDTO.id == null ? Colors.lightGreen : kBackgroundColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0),
image: resourceDetailDTO.id != null && resourceDetailDTO.type != ResourceType.videoUrl ? new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop),
image: new NetworkImage(
resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data,
),
) : null,
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
);
}
Future<List<ResourceDTO>> getResources(Function onGetResult, bool isImage, dynamic appContext) async {
List<ResourceDTO> resources = await appContext.getContext().clientAPI.resourceApi.resourceGet();
if (onGetResult != null && isImage) {
resources = resources.where((element) => element.type == ResourceType.image || element.type == ResourceType.imageUrl).toList();
}
return resources;
}

View File

@ -1,7 +1,9 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/fetch_resource_icon.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/resource_body_grid.dart';
import 'package:manager_app/Screens/Resources/show_resource_popup.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
@ -22,6 +24,7 @@ class ResourcesScreen extends StatefulWidget {
}
class _ResourcesScreenState extends State<ResourcesScreen> {
String filter;
@override
Widget build(BuildContext context) {
@ -34,8 +37,26 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
tempOutput.add(ResourceDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
// 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);
}
} 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 {
@ -45,108 +66,8 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
),
);
}
Widget bodyGrid(data, Size size, AppContext appContext) {
return GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return
InkWell(
onTap: () {
if (widget.onGetResult == null) {
// Main screen
if (data[index].id == null) {
showNewResource(appContext, context);
} else {
showResource(data[index], appContext, context, size);
}
} else {
if (data[index].id == null) {
showNewResource(appContext, context);
} else {
// Result for select modal
widget.onGetResult(data[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)
),
),
);
}
);
}
getElement(ResourceDTO resource, Size size, AppContext appContext) {
if (resource.id != null) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
height: size.width *0.01,
),
Align(
alignment: Alignment.center,
child: AutoSizeText(
resource.label == null ? "" : resource.label,
style: new TextStyle(fontSize: 20),
maxLines: 1,
),
),
Align(
alignment: Alignment.bottomRight,
child: Icon(
getResourceIcon(resource.type),
color: kPrimaryColor,
size: 25,
),
),
],
);
} else {
return Icon(
Icons.add,
color: kTextLightColor,
size: 80.0,
);
}
}
}
boxDecoration(dynamic resourceDetailDTO, appContext) {
return BoxDecoration(
color: resourceDetailDTO.id == null ? Colors.lightGreen : kBackgroundColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0),
image: resourceDetailDTO.id != null && resourceDetailDTO.type != ResourceType.videoUrl ? new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop),
image: new NetworkImage(
resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data,
),
) : null,
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
);
}
Future<List<ResourceDTO>> getResources(Function onGetResult, bool isImage, dynamic appContext) async {
List<ResourceDTO> resources = await appContext.getContext().clientAPI.resourceApi.resourceGet();
if (onGetResult != null && isImage) {