passo_mobile_app/lib/widgets/error_state.dart

58 lines
1.7 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:unit2/theme-data.dart/btn-style.dart';
import '../theme-data.dart/colors.dart';
class SomethingWentWrong extends StatelessWidget {
final String? message;
final Function()? onpressed;
const SomethingWentWrong({Key? key, required this.message, required this.onpressed})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SvgPicture.asset(
'assets/svgs/error.svg',
height: 200.0,
width: 200.0,
allowDrawingOutsideViewBox: true,
),
const SizedBox(
height: 10,
),
Text(
message??'',
textAlign: TextAlign.center,
),
const SizedBox(
height: 20,
),
SizedBox(
height: 50,
child: ElevatedButton.icon(
style: mainBtnStyle(
primary, Colors.transparent, primary.withOpacity(.5)),
onPressed: onpressed,
icon: const Icon(
Icons.refresh,
color: Colors.white,
),
label: const Text(
"try again",
style: TextStyle(color: Colors.white),
)),
)
],
),
),
);
}
}