12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import 'package:eitc_erm_dental_flutter/funcs.dart';
- import 'package:eitc_erm_dental_flutter/http/api_exception.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- class CustomErrorWidget extends StatelessWidget {
- final Object error;
- const CustomErrorWidget({super.key, required this.error});
- @override
- Widget build(BuildContext context) {
- return Column(mainAxisSize: MainAxisSize.min, children: [
- Icon(
- Icons.error_outline,
- size: 40.r,
- color: Colors.red,
- ),
- SizedBox(
- height: 10.h,
- ),
- _getText()
- ]);
- }
- Widget _getText() {
- String str;
- if (error is ApiException) {
- str = (error as ApiException).message ?? "";
- } else {
- str = "$error";
- }
- if (str.isEmpty) {
- str = getS().unknownException;
- }
- return Text(
- str,
- textAlign: TextAlign.center,
- style: TextStyle(color: Colors.red),
- );
- }
- }
|