1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-02-18 06:32:39 +00:00
comunicmobile/lib/utils/ui_utils.dart

48 lines
982 B
Dart
Raw Normal View History

2019-04-22 19:16:26 +02:00
import 'package:flutter/material.dart';
/// User interface utilities
2019-04-23 08:46:50 +02:00
/// Build centered progress bar
Widget buildCenteredProgressBar() {
return Center(
child: CircularProgressIndicator(),
);
}
2019-04-22 19:16:26 +02:00
/// Build and return a full loading page
Widget buildLoadingPage() {
return Scaffold(
2019-04-23 08:46:50 +02:00
body: buildCenteredProgressBar(),
2019-04-22 19:16:26 +02:00
);
}
/// Build and return an error card
Widget buildErrorCard(String message) {
return Card(
elevation: 2.0,
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Icon(
Icons.error,
color: Colors.white,
),
),
Flexible(
child: Text(
message,
style: TextStyle(color: Colors.white),
maxLines: null,
),
)
],
),
),
);
}