mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-29 19:13:36 -05:00
feat: add error screen to handle network and other errors
This commit is contained in:
42
lib/widgets/error_reload.dart
Normal file
42
lib/widgets/error_reload.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'link.dart';
|
||||
|
||||
class ErrorReload extends StatelessWidget {
|
||||
final String text;
|
||||
final Function reload;
|
||||
|
||||
ErrorReload({@required this.text, @required this.reload});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 30, horizontal: 20),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Woops, something bad happened. Error message:',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(top: 10)),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: Colors.redAccent,
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(top: 10)),
|
||||
Link(
|
||||
child: Text(
|
||||
'Reload',
|
||||
style: TextStyle(fontSize: 20, color: Colors.blueAccent),
|
||||
),
|
||||
beforeRedirect: reload,
|
||||
material: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user