fbmobile/lib/ui/widgets/centered_error_row.dart
2023-01-16 01:44:51 +01:00

47 lines
1.3 KiB
Dart

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