first commit
This commit is contained in:
88
lib/widget/my_error_dialog_state.dart
Normal file
88
lib/widget/my_error_dialog_state.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:queuedisplay/model/error_msg_model.dart';
|
||||
import 'package:queuedisplay/provider/all_service_provider.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
|
||||
Future<String?> myErrorDialogState(BuildContext context, String header) {
|
||||
return showDialog<String>(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) =>
|
||||
HookConsumer(builder: (context, ref, child) {
|
||||
return Dialog(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"Error",
|
||||
style: Constant.subTitle(context: context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 700),
|
||||
child: const Divider()),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(context: context, y: 500),
|
||||
width: Constant.getActualX(context: context, x: 700),
|
||||
child: ListView(
|
||||
// children: [Text(jsonEncode(ref.watch(errorListMsgProvider)))],
|
||||
children: ref
|
||||
.watch(errorListMsgProvider)
|
||||
.map((e) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
e.title.toString(),
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
Text(e.msg.toString()),
|
||||
// Text(jsonEncode(ref.watch(errorListMsgProvider))),
|
||||
SizedBox(
|
||||
height: Constant.getActualY(
|
||||
context: context, y: 20),
|
||||
)
|
||||
],
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 700),
|
||||
child: const Divider()),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 700),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
ref.read(errorListMsgProvider.notifier).state =
|
||||
List.empty(growable: true);
|
||||
},
|
||||
child: const Text('Tutup'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user