69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/rounded_button.dart';
|
|
import 'package:manager_app/Components/string_input_container.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
import 'package:managerapi/api.dart';
|
|
|
|
showChangeNameModal (String text, String name, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) {
|
|
Size size = MediaQuery.of(mainContext).size;
|
|
|
|
showDialog(
|
|
builder: (BuildContext context) => AlertDialog(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
|
),
|
|
title: Center(child: Text(text)),
|
|
content: SingleChildScrollView(
|
|
child: Center(
|
|
child: Container(
|
|
width: size.width * 0.3,
|
|
height: size.height * 0.15,
|
|
child: StringInputContainer(
|
|
label: "Nom :",
|
|
initialValue: name,
|
|
onChanged: (value) {
|
|
name = value;
|
|
},
|
|
),
|
|
),
|
|
)
|
|
),
|
|
actions: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Container(
|
|
width: 180,
|
|
height: 70,
|
|
child: RoundedButton(
|
|
text: "Annuler",
|
|
icon: Icons.undo,
|
|
color: kSecond,
|
|
press: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
Container(
|
|
width: 180,
|
|
height: 70,
|
|
child: RoundedButton(
|
|
text: "Changer",
|
|
icon: Icons.check,
|
|
color: kPrimaryColor,
|
|
textColor: kWhite,
|
|
press: () {
|
|
onGetResult(name);
|
|
Navigator.of(context).pop();
|
|
},
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
), context: mainContext
|
|
);
|
|
}
|