75 lines
2 KiB
Dart
75 lines
2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:seshat/ui/sell_page/view_model/sell_view_model.dart';
|
|
import 'package:seshat/ui/sell_page/widgets/sell_choice_popup.dart';
|
|
|
|
class ManualSearchPopup extends StatefulWidget {
|
|
const ManualSearchPopup({super.key, required this.viewModel});
|
|
|
|
final SellViewModel viewModel;
|
|
|
|
@override
|
|
State<ManualSearchPopup> createState() => _ManualSearchPopupState();
|
|
}
|
|
|
|
class _ManualSearchPopupState extends State<ManualSearchPopup> {
|
|
String? title = "";
|
|
String? author = "";
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
GlobalKey<FormState> _form = GlobalKey<FormState>();
|
|
|
|
return AlertDialog(
|
|
title: Text("Recherche manuelle"),
|
|
content: Form(
|
|
key: _form,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
labelText: "Titre",
|
|
border: OutlineInputBorder(),
|
|
),
|
|
onSaved: (newValue) => setState(() {
|
|
title = newValue;
|
|
}),
|
|
),
|
|
SizedBox(height: 10),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
labelText: "Auteur",
|
|
border: OutlineInputBorder(),
|
|
),
|
|
onSaved: (newValue) => setState(() {
|
|
author = newValue;
|
|
}),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text("Annuler"),
|
|
),
|
|
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
_form.currentState!.save();
|
|
Navigator.of(context).pop();
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) =>
|
|
SellChoicePopup(viewModel: widget.viewModel),
|
|
);
|
|
widget.viewModel.searchBook(title ?? "", author ?? "");
|
|
},
|
|
child: Text("Rechercher"),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|