mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 12:29:47 -05:00
Daniel Ponte
f41790d631
commit56ec3e3c53
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 15:49:50 2024 -0400 Fix exception in just_audio_media_kit commitc80625d07e
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 15:37:25 2024 -0400 Fix justaudio commitb7af6f28bb
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 14:44:18 2024 -0400 use justaudio only commit87d5354943
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 14:36:58 2024 -0400 Multiple audio drivers commit1e6b0d0439
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 14:08:14 2024 -0400 Fix on macos commit47cca3e3c0
Author: Daniel Ponte <amigan@gmail.com> Date: Wed Aug 14 13:10:12 2024 -0400 osx
79 lines
1.9 KiB
Dart
79 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'views/radio.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'views/login.dart';
|
|
import 'controller/stillbox.dart';
|
|
|
|
void main() {
|
|
runApp(ChangeNotifierProvider(
|
|
create: (context) => Stillbox(),
|
|
child: const CallsApp(),
|
|
));
|
|
}
|
|
|
|
class CallsApp extends StatelessWidget {
|
|
const CallsApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Stillbox Calls',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
darkTheme: ThemeData(
|
|
brightness: Brightness.dark,
|
|
scaffoldBackgroundColor: Colors.black,
|
|
),
|
|
themeMode: ThemeMode.dark,
|
|
home: const CallsHome(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class CallsHome extends StatefulWidget {
|
|
const CallsHome({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => CallsHomeState();
|
|
}
|
|
|
|
class CallsHomeState extends State<CallsHome> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
loadData();
|
|
});
|
|
}
|
|
|
|
Future<void> loadData() async {
|
|
// Ensure the navigation happens in the context of this widget's subtree
|
|
try {
|
|
final sb = Provider.of<Stillbox>(context, listen: false);
|
|
await sb.getBearer();
|
|
await sb.connect();
|
|
} catch (e) {
|
|
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');
|
|
}
|
|
}
|