Files
MovieLab/lib/widgets/loading_error.dart
Erfan Rahmati 7e41e06b44 Rename a folder
2022-06-26 13:07:04 +04:30

69 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:movielab/constants/colors.dart';
class LoadingErrorWidget extends StatelessWidget {
final String errorText;
final VoidCallback tryAgain;
const LoadingErrorWidget(
{this.errorText = 'An unexpected error occurred while loading data.',
required this.tryAgain,
Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 25, bottom: 25),
child: InkWell(
onTap: tryAgain,
borderRadius: BorderRadius.circular(10),
child: Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: kPrimaryColor.withOpacity(0.2),
),
child: Column(
children: [
Text(
errorText,
style: GoogleFonts.ubuntu(
color: Colors.white,
fontSize: 12.5,
fontWeight: FontWeight.w600),
),
const SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Try again',
style: GoogleFonts.ubuntu(
color: Colors.white,
fontSize: 12.5,
fontWeight: FontWeight.w600),
),
const Icon(
Icons.refresh,
color: Colors.white,
size: 15,
)
])
],
),
)),
),
],
),
],
);
}
}