Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
faild_to_fetch_data_view.dart
Go to the documentation of this file.
1import 'package:connect/core/localization/app_localizations.dart';
2
3import '/core/ui/widgets/custom_action_slider.dart';
4import '/core/ui/widgets/custom_card.dart';
5import 'package:flutter/material.dart';
6import 'package:flutter_screenutil/flutter_screenutil.dart';
7
8class FailedToFetchDataView extends StatelessWidget {
9 final VoidCallback onRetry;
10 final String? failureMessage;
11 final EdgeInsets? padding;
12
14 super.key,
15 required this.onRetry,
16 this.failureMessage,
17 this.padding,
18 });
19
20 @override
21 Widget build(BuildContext context) {
22 return Padding(
24 EdgeInsets.symmetric(
25 horizontal: 15.sp,
26 vertical: 10.sp,
27 ),
29 child: Column(
30 crossAxisAlignment: CrossAxisAlignment.start,
31 mainAxisSize: MainAxisSize.min,
32 children: [
33 Text(
34 AppLocalizations.of(context)
35 .translate('Oops! Something went wrong'),
36 style: Theme.of(context).textTheme.displaySmall?.copyWith(
37 color: Theme.of(context).colorScheme.error,
38 ),
39 ),
40 SizedBox(height: 10.sp),
41 Text(
43 'We encountered an issue while processing your request. Please retry'),
44 style: Theme.of(context).textTheme.bodySmall?.copyWith(),
45 ),
46 SizedBox(height: 15.sp),
47 Visibility(
48 visible: failureMessage != null,
49 child: Container(
50 width: MediaQuery.of(context).size.width,
51 margin: EdgeInsets.only(bottom: 15.sp),
52 decoration: BoxDecoration(
53 color: Theme.of(context).scaffoldBackgroundColor,
54 borderRadius: BorderRadius.circular(5),
55 ),
56 padding: EdgeInsets.all(10.sp),
57 child: Text(
58 '$failureMessage',
59 style: Theme.of(context).textTheme.bodySmall,
60 ),
61 ),
62 ),
64 color: Theme.of(context).colorScheme.error,
65 text: AppLocalizations.of(context).translate('TRY AGAIN'),
66 action: (action) {},
67 ),
68 ],
69 ),
70 ),
71 );
72 }
73}
String translate(String key)
static AppLocalizations of(BuildContext context)
const CustomCard({ super.key, required this.child, this.padding, this.bgColor, })
final Widget child
override Widget build(BuildContext context)
final VoidCallback onRetry
const FailedToFetchDataView({ super.key, required this.onRetry, this.failureMessage, this.padding, })
const CustomSliderV2({ super.key, required this.text, required this.action, this.color, })