UI fixes and league
This commit is contained in:
@@ -10,6 +10,7 @@ import '../services/google_calendar_service.dart';
|
||||
import '../services/notification_service.dart';
|
||||
import '../widgets/section.dart';
|
||||
import '../widgets/ui.dart';
|
||||
import 'league_view.dart';
|
||||
import 'settings_screen.dart';
|
||||
|
||||
enum EventType {
|
||||
@@ -32,7 +33,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
bool _isLoading = false;
|
||||
List<CalendarEvent> _events = [];
|
||||
String? _errorMessage;
|
||||
bool _showContacts = false;
|
||||
int _tab = 0; // 0 calendar, 1 contacts, 2 league
|
||||
String _query = '';
|
||||
|
||||
List<Contact> get _contacts => AppSettings.instance.clubContacts;
|
||||
@@ -534,8 +535,10 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
listenable: AppSettings.instance,
|
||||
builder: (context, _) {
|
||||
Widget body;
|
||||
if (_showContacts) {
|
||||
if (_tab == 1) {
|
||||
body = _buildContactsList();
|
||||
} else if (_tab == 2) {
|
||||
body = const LeagueView(); // loads each time the tab is opened
|
||||
} else if (_isLoading && _events.isEmpty) {
|
||||
body = const Center(child: CircularProgressIndicator());
|
||||
} else if (_errorMessage != null && _events.isEmpty) {
|
||||
@@ -567,9 +570,10 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
tabs: [
|
||||
BarTab(_t('Calendar'), Icons.calendar_today_outlined),
|
||||
BarTab(_t('Contacts'), Icons.person_add_alt_outlined),
|
||||
BarTab(_t('League'), Icons.emoji_events_outlined),
|
||||
],
|
||||
selected: _showContacts ? 1 : 0,
|
||||
onSelect: (i) => setState(() => _showContacts = i == 1),
|
||||
selected: _tab,
|
||||
onSelect: (i) => setState(() => _tab = i),
|
||||
),
|
||||
Expanded(child: body),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user