calls/lib/main.dart

72 lines
1.7 KiB
Dart
Raw Normal View History

2024-08-06 22:37:33 -04:00
import 'package:flutter/material.dart';
2024-08-10 13:27:12 -04:00
import 'views/radio.dart';
2024-08-12 09:13:43 -04:00
import 'views/login.dart';
import 'controller/ws.dart';
2024-08-06 22:37:33 -04:00
void main() {
2024-08-11 23:59:01 -04:00
runApp(const CallsApp());
2024-08-06 22:37:33 -04:00
}
2024-08-11 23:59:01 -04:00
class CallsApp extends StatelessWidget {
const CallsApp({super.key});
2024-08-06 22:37:33 -04:00
@override
Widget build(BuildContext context) {
return MaterialApp(
2024-08-08 18:31:24 -04:00
title: 'Stillbox Calls',
2024-08-06 22:37:33 -04:00
theme: ThemeData(
2024-08-08 18:31:24 -04:00
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
2024-08-06 22:37:33 -04:00
useMaterial3: true,
),
2024-08-08 18:31:24 -04:00
darkTheme: ThemeData(
brightness: Brightness.dark,
),
themeMode: ThemeMode.dark,
2024-08-12 09:13:43 -04:00
home: const CallsHome(),
2024-08-06 22:37:33 -04:00
);
}
}
2024-08-12 09:13:43 -04:00
class CallsHome extends StatefulWidget {
const CallsHome({super.key});
@override
State<StatefulWidget> createState() => CallsHomeState();
}
class CallsHomeState extends State<CallsHome> {
final c = Client();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
loadData();
});
}
Future<void> loadData() async {
await Future.delayed(const Duration(seconds: 1)); // Simulate some delay
// Ensure the navigation happens in the context of this widget's subtree
if (mounted) {
Navigator.pushReplacement(
context,
PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const Login(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return child;
},
transitionDuration: const Duration(milliseconds: 0),
),
);
}
}
@override
Widget build(BuildContext context) {
return const MainRadio(title: 'Stillbox');
}
}