fbmobile/lib/ui/widgets/centered_error_row.dart

45 lines
1.2 KiB
Dart
Raw Normal View History

2021-02-02 14:33:23 +00:00
import 'package:flutter/material.dart';
import '../shared/app_colors.dart';
class CenteredErrorRow extends StatelessWidget {
final Function? retryCallback;
final String? message;
2021-02-02 14:33:23 +00:00
2023-01-04 20:17:54 +00:00
const CenteredErrorRow(this.message, {super.key, this.retryCallback});
2021-02-02 14:33:23 +00:00
@override
Widget build(BuildContext context) {
if (message == null) {
return Container();
}
return Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
2023-01-04 20:17:54 +00:00
Expanded(child: Center(child: Text(message!, style: const TextStyle(color: redColor)))),
2021-02-02 14:33:23 +00:00
],
),
(retryCallback != null
? Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center(
child: IconButton(
2023-01-04 20:17:54 +00:00
icon: const Icon(Icons.refresh),
2021-02-02 14:33:23 +00:00
color: primaryAccentColor,
onPressed: () {
retryCallback!();
2021-02-02 14:33:23 +00:00
},
))
])
: Container())
],
);
}
}