fyral_comms 0.0.4
fyral_comms: ^0.0.4 copied to clipboard
Communication feature package for Fleet Glide Admin
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:fyral_comms/comms.dart';
void main() {
runApp(const CommsExampleApp());
}
/// A premium Example Application demonstrating the usage of the `comms` package.
class CommsExampleApp extends StatelessWidget {
const CommsExampleApp({super.key});
static final GoRouter _router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (context, state) => CommsPage(/*conversations: [
{
'name': 'Downtown Hub Community',
'message': 'Road closures near Broadway St.',
'time': '10:42 AM',
'tag': 'Public Community',
'avatarIconColor': Theme.of(context).colorScheme.primary,
'unreadCount': "4",
'isUnread': true,
'timeIcon': Icons.access_time_outlined,
},
{
'name': 'North Station Drivers',
'message': 'Weather warning: heavy storm approaching...',
'time': '09:15 AM',
'tag': 'Driver Community',
'avatarIconColor': Theme.of(context).colorScheme.primary,
'unreadCount': "2",
'isUnread': true,
'timeIcon': Icons.access_time_outlined,
},
{
'name': 'Admins Broadcast',
'message': 'Please complete weekly trip logs.',
'time': 'Yesterday',
'tag': 'Broadcast',
'avatarIconColor': Theme.of(context).colorScheme.primary,
'unreadCount': "1",
'isUnread': false,
'timeIcon': Icons.calendar_today_outlined,
},
{
'name': 'Operations Team',
'message': 'Mike: Van 58 is ready for pickup.',
'time': 'Monday',
'tag': 'Private Group',
'avatarIconColor': Theme.of(context).colorScheme.primary,
'unreadCount': "0",
'isUnread': false,
'timeIcon': Icons.access_time_outlined,
},
],*/),
),
GoRoute(
path: '/chat/:title',
builder: (context, state) {
final title = state.pathParameters['title'] ?? 'Chat';
return ConversationDetailPage(title: title, showAppBar: false,);
},
),
],
);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'Comms Package Example',
themeMode: ThemeMode.system,
debugShowCheckedModeBanner: false,
// Premium Light Theme
theme: ThemeData(
useMaterial3: true,
brightness: Brightness.light,
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF653DAA), // Modern purple seed color
primary: const Color(0xFF653DAA),
secondary: const Color(0xFFF97316), // Vibrant orange
surface: Colors.white,
onSurface: const Color(0xFF1E293B),
),
scaffoldBackgroundColor: const Color(0xFFF8FAFC),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: false,
),
),
// Premium Dark Theme
darkTheme: ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF8B5CF6),
brightness: Brightness.dark,
primary: const Color(0xFFA78BFA),
secondary: const Color(0xFFFB923C),
surface: const Color(0xFF0F172A),
onSurface: const Color(0xFFF1F5F9),
),
scaffoldBackgroundColor: const Color(0xFF020617),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: false,
),
),
routerConfig: _router,
);
}
}