orientação
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart'; // Para as orientações
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'package:playmaker/classe/theme.dart'; // 👇 IMPORTA O TEU TEMA
|
||||
import 'package:playmaker/classe/theme.dart';
|
||||
import 'pages/login.dart';
|
||||
|
||||
// ========================================================
|
||||
// 👇 A VARIÁVEL MÁGICA QUE FALTAVA (Fora do void main) 👇
|
||||
// ========================================================
|
||||
// Variável global para controlar o Tema
|
||||
final ValueNotifier<ThemeMode> themeNotifier = ValueNotifier(ThemeMode.system);
|
||||
|
||||
void main() async {
|
||||
// 1. Inicializa os bindings do Flutter
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// 2. Inicializa o Supabase
|
||||
await Supabase.initialize(
|
||||
url: 'https://sihwjdshexjyvsbettcd.supabase.co',
|
||||
anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNpaHdqZHNoZXhqeXZzYmV0dGNkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg5MTQxMjgsImV4cCI6MjA4NDQ5MDEyOH0.gW3AvTJVNyE1Dqa72OTnhrUIKsndexrY3pKxMIAaAy8',
|
||||
);
|
||||
|
||||
// 3. Deixa a orientação livre (Portrait) para o arranque da App
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -24,7 +30,6 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// FICA À ESCUTA DO THEMENOTIFIER
|
||||
return ValueListenableBuilder<ThemeMode>(
|
||||
valueListenable: themeNotifier,
|
||||
builder: (_, ThemeMode currentMode, __) {
|
||||
@@ -33,7 +38,7 @@ class MyApp extends StatelessWidget {
|
||||
title: 'PlayMaker',
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: currentMode, // 👇 ISTO RECEBE O VALOR DO NOTIFIER
|
||||
themeMode: currentMode,
|
||||
home: const LoginPage(),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user