update error builder
This commit is contained in:
@@ -194,50 +194,33 @@ class _UserListViewState extends State<UserListView>
|
|||||||
bool get isListAlreadySorted =>
|
bool get isListAlreadySorted =>
|
||||||
widget.sort?.any((e) => e.field == 'name' && e.direction == 1) ?? false;
|
widget.sort?.any((e) => e.field == 'name' && e.direction == 1) ?? false;
|
||||||
|
|
||||||
Widget _buildError(Object error) {
|
Widget _buildError(Object error) => Center(
|
||||||
var message = error.toString();
|
child: Column(
|
||||||
if (error is DioError) {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
final dioError = error;
|
children: <Widget>[
|
||||||
if (dioError.type == DioErrorType.response) {
|
Text.rich(
|
||||||
message = dioError.message;
|
const TextSpan(
|
||||||
} else {
|
children: [
|
||||||
message = 'Check your connection and retry';
|
WidgetSpan(
|
||||||
}
|
child: Padding(
|
||||||
}
|
padding: EdgeInsets.only(
|
||||||
return Center(
|
right: 2,
|
||||||
child: Column(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Icon(Icons.error_outline),
|
||||||
children: <Widget>[
|
|
||||||
Text.rich(
|
|
||||||
const TextSpan(
|
|
||||||
children: [
|
|
||||||
WidgetSpan(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
right: 2,
|
|
||||||
),
|
),
|
||||||
child: Icon(Icons.error_outline),
|
|
||||||
),
|
),
|
||||||
),
|
TextSpan(text: 'Error loading users'),
|
||||||
TextSpan(text: 'Error loading channels'),
|
],
|
||||||
],
|
),
|
||||||
|
style: Theme.of(context).textTheme.headline6,
|
||||||
),
|
),
|
||||||
style: Theme.of(context).textTheme.headline6,
|
TextButton(
|
||||||
),
|
onPressed: () => _userListController.loadData!(),
|
||||||
Padding(
|
child: const Text('Retry'),
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 16,
|
|
||||||
),
|
),
|
||||||
child: Text(message),
|
],
|
||||||
),
|
),
|
||||||
TextButton(
|
);
|
||||||
onPressed: () => _userListController.loadData!(),
|
|
||||||
child: const Text('Retry'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildEmpty() => LayoutBuilder(
|
Widget _buildEmpty() => LayoutBuilder(
|
||||||
builder: (context, viewportConstraints) => SingleChildScrollView(
|
builder: (context, viewportConstraints) => SingleChildScrollView(
|
||||||
|
|||||||
Reference in New Issue
Block a user