kamus-kesehatan/lib/ui/views/action_dialog/action_dialog_view.dart

65 lines
2.0 KiB
Dart
Raw Permalink Normal View History

2024-02-04 12:57:23 +00:00
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
2024-07-27 12:06:56 +00:00
import '../../../model/istilah_model1.dart';
2024-02-04 12:57:23 +00:00
import './action_dialog_view_model.dart';
class ActionDialogView extends StatelessWidget {
2024-07-27 12:06:56 +00:00
final DialogRequest<IstilahModel1> request;
2024-02-04 12:57:23 +00:00
final Function(DialogResponse) completer;
const ActionDialogView({
Key? key,
2024-07-27 12:06:56 +00:00
required DialogRequest request,
2024-02-04 12:57:23 +00:00
required this.completer,
2024-07-27 12:06:56 +00:00
}) : request = request as DialogRequest<IstilahModel1>,
super(key: key);
2024-02-04 12:57:23 +00:00
@override
Widget build(BuildContext context) {
return ViewModelBuilder<ActionDialogViewModel>.reactive(
viewModelBuilder: () => ActionDialogViewModel(),
onViewModelReady: (ActionDialogViewModel model) async {
await model.init(request.data);
},
builder: (
BuildContext context,
ActionDialogViewModel model,
Widget? child,
) {
return Dialog(
child: Container(
padding: const EdgeInsets.all(20),
// create a row with 2 circle icon , 1 is whataspp icon, 2 is bookmark, no need text
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CircleAvatar(
backgroundColor: Colors.green,
child: IconButton(
icon: const Icon(Icons.phone),
onPressed: () {
// completer(DialogResponse(confirmed: true));
model.openWhatsapp();
},
),
),
CircleAvatar(
backgroundColor: Colors.blue,
child: IconButton(
icon: const Icon(Icons.bookmark),
onPressed: () {
model.addBookmark(request.data!);
},
),
),
],
),
),
);
},
);
}
}