import 'package:flutter/material.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; import 'package:intl/intl.dart'; void showRessource(RessourceDTO ressourceDTO,AppContext appContext, BuildContext context) { showDialog( builder: (BuildContext context) => AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(20.0)) ), content: SingleChildScrollView( child: Column( children: [ Text(ressourceDTO.label, style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), Text('TODO CHARGE IMAGE'), Text("TODO SHOW IMAGE OR VIDEO") ], ), ), actions: [ Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Align( alignment: AlignmentDirectional.bottomEnd, child: Container( width: 175, height: 70, child: RoundedButton( text: "Retour", icon: Icons.undo, color: kSecond, press: () { Navigator.of(context).pop(); }, fontSize: 20, ), ), ), Align( alignment: AlignmentDirectional.bottomEnd, child: Container( width: 200, height: 70, child: RoundedButton( text: "Supprimer", icon: Icons.delete, color: kPrimaryColor, textColor: kWhite, press: () { delete(ressourceDTO, appContext, context); }, fontSize: 20, ), ), ), ], ), ], ), context: context ); } void delete(RessourceDTO ressourceDTO, AppContext appContext, context) async { if (ressourceDTO.label != null) { Navigator.of(context).pop(); //RessourceDetailDTO newRessource = await appContext.getContext().clientAPI.ressourceApi.ressourceCreate(ressourceDetailDTO); print("TODO DELETE"); /*print(newRessource); // To refresh only (UGLY COOOOODE) ManagerAppContext managerAppContext = appContext.getContext(); appContext.setContext(managerAppContext); showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);*/ } }