Add admin management tabs and TV/mobile fixes
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.software.leanback"
|
||||||
|
android:required="false" />
|
||||||
<application
|
<application
|
||||||
android:label="google_tv_dashboard"
|
android:label="google_tv_dashboard"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
@@ -23,6 +28,7 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
|
|||||||
BIN
flutter_app/assets/fonts/Mulish-Regular.ttf
Normal file
BIN
flutter_app/assets/fonts/Mulish-Regular.ttf
Normal file
Binary file not shown.
BIN
flutter_app/assets/fonts/Outfit-Bold.ttf
Normal file
BIN
flutter_app/assets/fonts/Outfit-Bold.ttf
Normal file
Binary file not shown.
BIN
flutter_app/assets/fonts/Outfit-Medium.ttf
Normal file
BIN
flutter_app/assets/fonts/Outfit-Medium.ttf
Normal file
Binary file not shown.
BIN
flutter_app/assets/fonts/Outfit-SemiBold.ttf
Normal file
BIN
flutter_app/assets/fonts/Outfit-SemiBold.ttf
Normal file
Binary file not shown.
@@ -22,6 +22,7 @@ Future<void> main() async {
|
|||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
// Hide status bar for TV immersive experience
|
// Hide status bar for TV immersive experience
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
||||||
|
GoogleFonts.config.allowRuntimeFetching = false;
|
||||||
|
|
||||||
await initializeDateFormatting();
|
await initializeDateFormatting();
|
||||||
|
|
||||||
@@ -120,9 +121,8 @@ class MyApp extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
initialRoute: '/',
|
home: const AdaptiveHome(),
|
||||||
routes: {
|
routes: {
|
||||||
'/': (context) => const TvDashboardScreen(),
|
|
||||||
'/mobile': (context) => const MobileHomeScreen(),
|
'/mobile': (context) => const MobileHomeScreen(),
|
||||||
'/admin': (context) => const AdminScreen(),
|
'/admin': (context) => const AdminScreen(),
|
||||||
},
|
},
|
||||||
@@ -130,3 +130,25 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AdaptiveHome extends StatelessWidget {
|
||||||
|
const AdaptiveHome({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
const forceTv = String.fromEnvironment('FORCE_TV', defaultValue: 'false');
|
||||||
|
if (forceTv.toLowerCase() == 'true') {
|
||||||
|
return const TvDashboardScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
final size = MediaQuery.of(context).size;
|
||||||
|
final shortestSide = size.shortestSide;
|
||||||
|
final isMobile = shortestSide < 600;
|
||||||
|
|
||||||
|
if (isMobile) {
|
||||||
|
return const MobileHomeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
return const TvDashboardScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ import 'package:provider/provider.dart';
|
|||||||
import '../../models/bible_verse.dart';
|
import '../../models/bible_verse.dart';
|
||||||
import '../../models/family_member.dart';
|
import '../../models/family_member.dart';
|
||||||
import '../../models/photo.dart';
|
import '../../models/photo.dart';
|
||||||
|
import '../../models/announcement.dart';
|
||||||
|
import '../../models/schedule_item.dart';
|
||||||
import '../../services/bible_verse_service.dart';
|
import '../../services/bible_verse_service.dart';
|
||||||
import '../../services/family_service.dart';
|
import '../../services/family_service.dart';
|
||||||
import '../../services/photo_service.dart';
|
import '../../services/photo_service.dart';
|
||||||
|
import '../../services/announcement_service.dart';
|
||||||
|
import '../../services/schedule_service.dart';
|
||||||
|
|
||||||
class AdminScreen extends StatefulWidget {
|
class AdminScreen extends StatefulWidget {
|
||||||
const AdminScreen({super.key});
|
const AdminScreen({super.key});
|
||||||
@@ -18,15 +22,18 @@ class _AdminScreenState extends State<AdminScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultTabController(
|
return DefaultTabController(
|
||||||
length: 3,
|
length: 5,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Admin Settings'),
|
title: const Text('Admin Settings'),
|
||||||
bottom: const TabBar(
|
bottom: const TabBar(
|
||||||
|
isScrollable: true,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(text: 'Family Members'),
|
Tab(text: 'Family Members'),
|
||||||
Tab(text: 'Photos'),
|
Tab(text: 'Photos'),
|
||||||
Tab(text: 'Bible Verses'),
|
Tab(text: 'Bible Verses'),
|
||||||
|
Tab(text: 'Announcements'),
|
||||||
|
Tab(text: 'Schedules'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -35,6 +42,8 @@ class _AdminScreenState extends State<AdminScreen> {
|
|||||||
FamilyManagerTab(),
|
FamilyManagerTab(),
|
||||||
PhotoManagerTab(),
|
PhotoManagerTab(),
|
||||||
BibleVerseManagerTab(),
|
BibleVerseManagerTab(),
|
||||||
|
AnnouncementManagerTab(),
|
||||||
|
ScheduleManagerTab(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -448,3 +457,344 @@ class _BibleVerseManagerTabState extends State<BibleVerseManagerTab> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AnnouncementManagerTab extends StatefulWidget {
|
||||||
|
const AnnouncementManagerTab({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AnnouncementManagerTab> createState() => _AnnouncementManagerTabState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnnouncementManagerTabState extends State<AnnouncementManagerTab> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () => _showAddAnnouncementDialog(context),
|
||||||
|
child: const Icon(Icons.campaign),
|
||||||
|
),
|
||||||
|
body: FutureBuilder<List<Announcement>>(
|
||||||
|
future: Provider.of<AnnouncementService>(context).fetchAnnouncements(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
final announcements = snapshot.data!;
|
||||||
|
if (announcements.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'No announcements added yet',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: announcements.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final announcement = announcements[index];
|
||||||
|
return ListTile(
|
||||||
|
title: Text(announcement.title),
|
||||||
|
subtitle: Text(
|
||||||
|
announcement.content,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
trailing: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (announcement.priority > 0)
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 6, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.orangeAccent,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'P${announcement.priority}',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white, fontSize: 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Icon(
|
||||||
|
announcement.active ? Icons.check_circle : Icons.cancel,
|
||||||
|
color: announcement.active ? Colors.green : Colors.grey,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.delete, color: Colors.red),
|
||||||
|
onPressed: () async {
|
||||||
|
await Provider.of<AnnouncementService>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).deleteAnnouncement(announcement.id);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showAddAnnouncementDialog(BuildContext context) {
|
||||||
|
final titleController = TextEditingController();
|
||||||
|
final contentController = TextEditingController();
|
||||||
|
final priorityController = TextEditingController(text: '0');
|
||||||
|
bool isActive = true;
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => StatefulBuilder(
|
||||||
|
builder: (context, setDialogState) => AlertDialog(
|
||||||
|
title: const Text('Add Announcement'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: titleController,
|
||||||
|
decoration: const InputDecoration(labelText: 'Title'),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: contentController,
|
||||||
|
decoration: const InputDecoration(labelText: 'Content'),
|
||||||
|
maxLines: 3,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: priorityController,
|
||||||
|
decoration:
|
||||||
|
const InputDecoration(labelText: 'Priority (0-10)'),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
title: const Text('Active'),
|
||||||
|
value: isActive,
|
||||||
|
onChanged: (value) {
|
||||||
|
setDialogState(() {
|
||||||
|
isActive = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: const Text('Cancel'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (titleController.text.isNotEmpty) {
|
||||||
|
await Provider.of<AnnouncementService>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).createAnnouncement(
|
||||||
|
Announcement(
|
||||||
|
id: '',
|
||||||
|
title: titleController.text,
|
||||||
|
content: contentController.text,
|
||||||
|
priority: int.tryParse(priorityController.text) ?? 0,
|
||||||
|
active: isActive,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('Add'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScheduleManagerTab extends StatefulWidget {
|
||||||
|
const ScheduleManagerTab({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ScheduleManagerTab> createState() => _ScheduleManagerTabState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ScheduleManagerTabState extends State<ScheduleManagerTab> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () => _showAddScheduleDialog(context),
|
||||||
|
child: const Icon(Icons.calendar_today),
|
||||||
|
),
|
||||||
|
body: FutureBuilder<List<ScheduleItem>>(
|
||||||
|
future: Provider.of<ScheduleService>(context).fetchSchedules(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
final schedules = snapshot.data!;
|
||||||
|
if (schedules.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'No schedules added yet',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: schedules.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final schedule = schedules[index];
|
||||||
|
return ListTile(
|
||||||
|
title: Text(schedule.title),
|
||||||
|
subtitle: Text(
|
||||||
|
'${schedule.description}\n${schedule.startDate.toIso8601String().split('T')[0]} ~ ${schedule.endDate.toIso8601String().split('T')[0]}',
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
isThreeLine: true,
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Icons.delete, color: Colors.red),
|
||||||
|
onPressed: () async {
|
||||||
|
await Provider.of<ScheduleService>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).deleteSchedule(schedule.id);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showAddScheduleDialog(BuildContext context) {
|
||||||
|
final titleController = TextEditingController();
|
||||||
|
final descriptionController = TextEditingController();
|
||||||
|
final startController = TextEditingController(
|
||||||
|
text: DateTime.now().toIso8601String().split('T')[0],
|
||||||
|
);
|
||||||
|
final endController = TextEditingController(
|
||||||
|
text: DateTime.now().toIso8601String().split('T')[0],
|
||||||
|
);
|
||||||
|
bool isAllDay = true;
|
||||||
|
String? selectedFamilyMemberId;
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => StatefulBuilder(
|
||||||
|
builder: (context, setDialogState) => AlertDialog(
|
||||||
|
title: const Text('Add Schedule'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: titleController,
|
||||||
|
decoration: const InputDecoration(labelText: 'Title'),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: descriptionController,
|
||||||
|
decoration: const InputDecoration(labelText: 'Description'),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: startController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Start Date (YYYY-MM-DD)',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: endController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'End Date (YYYY-MM-DD)',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
title: const Text('All Day'),
|
||||||
|
value: isAllDay,
|
||||||
|
onChanged: (value) {
|
||||||
|
setDialogState(() {
|
||||||
|
isAllDay = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
FutureBuilder<List<FamilyMember>>(
|
||||||
|
future: Provider.of<FamilyService>(context, listen: false)
|
||||||
|
.fetchFamilyMembers(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) return const SizedBox();
|
||||||
|
final members = snapshot.data!;
|
||||||
|
return DropdownButtonFormField<String>(
|
||||||
|
value: selectedFamilyMemberId,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Family Member',
|
||||||
|
),
|
||||||
|
items: members.map((member) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: member.id,
|
||||||
|
child: Text(member.name),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
setDialogState(() {
|
||||||
|
selectedFamilyMemberId = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: const Text('Cancel'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (titleController.text.isNotEmpty) {
|
||||||
|
final startDate =
|
||||||
|
DateTime.tryParse(startController.text) ?? DateTime.now();
|
||||||
|
final endDate =
|
||||||
|
DateTime.tryParse(endController.text) ?? DateTime.now();
|
||||||
|
|
||||||
|
await Provider.of<ScheduleService>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).createSchedule(
|
||||||
|
ScheduleItem(
|
||||||
|
id: '',
|
||||||
|
title: titleController.text,
|
||||||
|
description: descriptionController.text,
|
||||||
|
startDate: startDate,
|
||||||
|
endDate: endDate,
|
||||||
|
familyMemberId: selectedFamilyMemberId ?? '',
|
||||||
|
isAllDay: isAllDay,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('Add'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -47,84 +48,102 @@ class _TvDashboardScreenState extends State<TvDashboardScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// 1920x1080 reference
|
// 1920x1080 reference
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SafeArea(
|
body: Center(
|
||||||
child: Padding(
|
child: AspectRatio(
|
||||||
padding: const EdgeInsets.all(32.0), // Outer margin safe zone
|
aspectRatio: 16 / 9,
|
||||||
child: Column(
|
child: FittedBox(
|
||||||
children: [
|
fit: BoxFit.contain,
|
||||||
// Header: Time and Weather
|
child: SizedBox(
|
||||||
SizedBox(
|
width: 1920,
|
||||||
height: 100,
|
height: 1080,
|
||||||
child: Row(
|
child: Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
padding: const EdgeInsets.all(32.0), // Outer margin safe zone
|
||||||
children: [const DigitalClockWidget(), const WeatherWidget()],
|
child: Column(
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
// Main Content Grid
|
|
||||||
Expanded(
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
// Left Column: Calendar, Schedule, Announcement
|
// Header: Time and Weather
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 3,
|
height: 100,
|
||||||
child: Column(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Expanded(flex: 4, child: CalendarWidget()),
|
const DigitalClockWidget(),
|
||||||
const SizedBox(height: 16),
|
const WeatherWidget()
|
||||||
const Expanded(flex: 4, child: ScheduleListWidget()),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
const Expanded(flex: 2, child: AnnouncementWidget()),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24),
|
const SizedBox(height: 24),
|
||||||
// Center Column: Photo Slideshow
|
// Main Content Grid
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
child: Row(
|
||||||
child: Container(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
borderRadius: BorderRadius.circular(16),
|
// Left Column: Calendar, Schedule, Announcement
|
||||||
boxShadow: [
|
Expanded(
|
||||||
BoxShadow(
|
flex: 3,
|
||||||
color: Colors.black.withOpacity(0.5),
|
child: Column(
|
||||||
blurRadius: 20,
|
children: [
|
||||||
offset: const Offset(0, 10),
|
const Expanded(
|
||||||
|
flex: 4, child: CalendarWidget()),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
const Expanded(
|
||||||
|
flex: 4, child: ScheduleListWidget()),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
const Expanded(
|
||||||
|
flex: 2, child: AnnouncementWidget()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(width: 24),
|
||||||
clipBehavior: Clip.antiAlias,
|
// Center Column: Photo Slideshow
|
||||||
child: const PhotoSlideshowWidget(),
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 10),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
child: const PhotoSlideshowWidget(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
// Right Column: Todos, Bible Verse
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Expanded(
|
||||||
|
flex: 6, child: TodoListWidget()),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
const Expanded(
|
||||||
|
flex: 3, child: BibleVerseWidget()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24),
|
// Hidden trigger for admin/mobile view (e.g. long press corner)
|
||||||
// Right Column: Todos, Bible Verse
|
GestureDetector(
|
||||||
Expanded(
|
onLongPress: () {
|
||||||
flex: 3,
|
Navigator.of(context).pushNamed('/admin');
|
||||||
child: Column(
|
},
|
||||||
children: [
|
child: Container(
|
||||||
const Expanded(flex: 6, child: TodoListWidget()),
|
width: 50,
|
||||||
const SizedBox(height: 16),
|
height: 50,
|
||||||
const Expanded(flex: 3, child: BibleVerseWidget()),
|
color: Colors.transparent,
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Hidden trigger for admin/mobile view (e.g. long press corner)
|
),
|
||||||
GestureDetector(
|
|
||||||
onLongPress: () {
|
|
||||||
Navigator.of(context).pushNamed('/admin');
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
color: Colors.transparent,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ class CalendarWidget extends StatelessWidget {
|
|||||||
// If we want Sun start: Sun=0, Mon=1...
|
// If we want Sun start: Sun=0, Mon=1...
|
||||||
// Let's adjust so Sunday is first.
|
// Let's adjust so Sunday is first.
|
||||||
|
|
||||||
int offset =
|
int offset = startingWeekday %
|
||||||
startingWeekday %
|
|
||||||
7; // If startingWeekday is 7 (Sun), offset is 0. If 1 (Mon), offset is 1.
|
7; // If startingWeekday is 7 (Sun), offset is 0. If 1 (Mon), offset is 1.
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
@@ -39,9 +38,9 @@ class CalendarWidget extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
DateFormat('MMMM yyyy').format(now),
|
DateFormat('MMMM yyyy').format(now),
|
||||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Icon(Icons.calendar_today, color: Colors.white54),
|
const Icon(Icons.calendar_today, color: Colors.white54),
|
||||||
],
|
],
|
||||||
@@ -67,42 +66,50 @@ class CalendarWidget extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// Days Grid
|
// Days Grid
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GridView.builder(
|
child: Column(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
children: List.generate(6, (row) {
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
return Expanded(
|
||||||
crossAxisCount: 7,
|
child: Row(
|
||||||
childAspectRatio: 1.0,
|
children: List.generate(7, (col) {
|
||||||
),
|
final index = row * 7 + col;
|
||||||
itemCount: 42, // 6 rows max to be safe
|
final dayNumber = index - offset + 1;
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final dayNumber = index - offset + 1;
|
|
||||||
if (dayNumber < 1 || dayNumber > daysInMonth) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
final isToday = dayNumber == now.day;
|
if (dayNumber < 1 || dayNumber > daysInMonth) {
|
||||||
|
return const Expanded(child: SizedBox.shrink());
|
||||||
|
}
|
||||||
|
|
||||||
return Container(
|
final isToday = dayNumber == now.day;
|
||||||
margin: const EdgeInsets.all(4),
|
|
||||||
decoration: isToday
|
return Expanded(
|
||||||
? BoxDecoration(
|
child: Container(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
margin: const EdgeInsets.all(2),
|
||||||
shape: BoxShape.circle,
|
decoration: isToday
|
||||||
)
|
? BoxDecoration(
|
||||||
: null,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
child: Center(
|
shape: BoxShape.circle,
|
||||||
child: Text(
|
)
|
||||||
'$dayNumber',
|
: null,
|
||||||
style: TextStyle(
|
child: Center(
|
||||||
color: isToday ? Colors.black : Colors.white,
|
child: FittedBox(
|
||||||
fontWeight: isToday
|
fit: BoxFit.scaleDown,
|
||||||
? FontWeight.bold
|
child: Text(
|
||||||
: FontWeight.normal,
|
'$dayNumber',
|
||||||
),
|
style: TextStyle(
|
||||||
),
|
color: isToday ? Colors.black : Colors.white,
|
||||||
|
fontWeight: isToday
|
||||||
|
? FontWeight.bold
|
||||||
|
: FontWeight.normal,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -21,3 +21,16 @@ dev_dependencies:
|
|||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
fonts:
|
||||||
|
- family: Outfit
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/Outfit-Medium.ttf
|
||||||
|
weight: 500
|
||||||
|
- asset: assets/fonts/Outfit-SemiBold.ttf
|
||||||
|
weight: 600
|
||||||
|
- asset: assets/fonts/Outfit-Bold.ttf
|
||||||
|
weight: 700
|
||||||
|
- family: Mulish
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/Mulish-Regular.ttf
|
||||||
|
weight: 400
|
||||||
|
|||||||
Reference in New Issue
Block a user