Files
PlayMaker/lib/main.dart
2026-03-16 22:09:01 +00:00

42 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:playmaker/classe/theme.dart'; // 👇 IMPORTA O TEU TEMA
import 'pages/login.dart';
// ========================================================
// 👇 A VARIÁVEL MÁGICA QUE FALTAVA (Fora do void main) 👇
// ========================================================
final ValueNotifier<ThemeMode> themeNotifier = ValueNotifier(ThemeMode.system);
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: 'https://sihwjdshexjyvsbettcd.supabase.co',
anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNpaHdqZHNoZXhqeXZzYmV0dGNkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg5MTQxMjgsImV4cCI6MjA4NDQ5MDEyOH0.gW3AvTJVNyE1Dqa72OTnhrUIKsndexrY3pKxMIAaAy8',
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// FICA À ESCUTA DO THEMENOTIFIER
return ValueListenableBuilder<ThemeMode>(
valueListenable: themeNotifier,
builder: (_, ThemeMode currentMode, __) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'PlayMaker',
theme: AppTheme.lightTheme,
darkTheme: AppTheme.darkTheme,
themeMode: currentMode, // 👇 ISTO RECEBE O VALOR DO NOTIFIER
home: const LoginPage(),
);
},
);
}
}