Line data Source code
1 : //TODO: improve this 2 : import 'package:flutter/foundation.dart'; 3 : import 'package:flutter/material.dart'; 4 : 5 : /// The default Error State Widget to display errors 6 : class ErrorStateWidget extends StatelessWidget { 7 : /// Builds an [ErrorStateWidget]. 8 13 : const ErrorStateWidget({ 9 : Key? key, 10 : this.message = 'Sorry an error has occured', 11 1 : }) : super(key: key); 12 : 13 : /// The error message to display 14 : final String message; 15 : 16 1 : @override 17 : Widget build(BuildContext context) { 18 1 : return Center( 19 1 : child: Column( 20 1 : children: [ 21 : const Icon( 22 : Icons.announcement, 23 : color: Colors.red, 24 : size: 40, 25 : ), 26 : const SizedBox(height: 10), 27 1 : Text( 28 1 : message, 29 : textAlign: TextAlign.center, 30 : ), 31 : ], 32 : ), 33 : ); 34 : } 35 : 36 1 : @override 37 : void debugFillProperties(DiagnosticPropertiesBuilder properties) { 38 1 : super.debugFillProperties(properties); 39 3 : properties.add(StringProperty('message', message)); 40 : } 41 : }