Skip to content

Commit 3dbb7db

Browse files
authored
Update main.dart [build]
1 parent 4f4f5dd commit 3dbb7db

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

lib/main.dart

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:dynamic_color/dynamic_color.dart'; // Obavezan import
23
import 'ui/screens/home_screen.dart';
34
import 'ui/screens/document_viewer_screen.dart';
45

@@ -11,14 +12,53 @@ class FSentenceApp extends StatelessWidget {
1112

1213
@override
1314
Widget build(BuildContext context) {
14-
return MaterialApp(
15-
title: 'f.Sentence',
16-
debugShowCheckedModeBanner: false,
17-
theme: ThemeData(
18-
colorScheme: ColorScheme.fromSeed(seedColor: Colors.orange),
19-
useMaterial3: true,
20-
),
21-
home: const HomeScreen(),
15+
// Ovo je "magija" koja izvlači boje iz sistema
16+
return DynamicColorBuilder(
17+
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
18+
19+
// Definišemo fallback boje (ako sistem nema dynamic color)
20+
ColorScheme lightColorScheme = lightDynamic ?? ColorScheme.fromSeed(
21+
seedColor: Colors.orange,
22+
);
23+
24+
ColorScheme darkColorScheme = darkDynamic ?? ColorScheme.fromSeed(
25+
seedColor: Colors.orange,
26+
brightness: Brightness.dark,
27+
);
28+
29+
return MaterialApp(
30+
title: 'f.Sentence',
31+
debugShowCheckedModeBanner: false,
32+
33+
// SVETLA TEMA
34+
theme: ThemeData(
35+
useMaterial3: true,
36+
colorScheme: lightColorScheme,
37+
// Ovde smo "ubacili" tvoje tanke headinge
38+
textTheme: const TextTheme(
39+
headlineLarge: TextStyle(fontWeight: FontWeight.w300),
40+
headlineMedium: TextStyle(fontWeight: FontWeight.w300),
41+
titleLarge: TextStyle(fontWeight: FontWeight.w300),
42+
),
43+
),
44+
45+
// TAMNA TEMA
46+
darkTheme: ThemeData(
47+
useMaterial3: true,
48+
colorScheme: darkColorScheme,
49+
textTheme: const TextTheme(
50+
headlineLarge: TextStyle(fontWeight: FontWeight.w300),
51+
headlineMedium: TextStyle(fontWeight: FontWeight.w300),
52+
titleLarge: TextStyle(fontWeight: FontWeight.w300),
53+
),
54+
),
55+
56+
// Automatski prebacuje na dark mode ako je tako na sistemu
57+
themeMode: ThemeMode.system,
58+
59+
home: const HomeScreen(),
60+
);
61+
},
2262
);
2363
}
2464
}

0 commit comments

Comments
 (0)