Make dark theme
This commit is contained in:
@@ -37,14 +37,64 @@ void main() async {
|
|||||||
class JournalerApp extends StatelessWidget {
|
class JournalerApp extends StatelessWidget {
|
||||||
const JournalerApp({super.key});
|
const JournalerApp({super.key});
|
||||||
|
|
||||||
|
// Define the light theme
|
||||||
|
static final ThemeData lightTheme = ThemeData(
|
||||||
|
brightness: Brightness.light,
|
||||||
|
primarySwatch: Colors.blue, // Or use ColorScheme.fromSeed(seedColor: Colors.blue)
|
||||||
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
|
scaffoldBackgroundColor: Colors.grey[100], // Slightly off-white
|
||||||
|
appBarTheme: const AppBarTheme(
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
foregroundColor: Colors.white, // Title and icons
|
||||||
|
),
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.blue.shade600, width: 2.0),
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
// Add other theme properties like textTheme if needed
|
||||||
|
);
|
||||||
|
|
||||||
|
// Define the dark theme
|
||||||
|
static final ThemeData darkTheme = ThemeData(
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
primarySwatch: Colors.blue, // Keep blue, or choose a different shade
|
||||||
|
// Or use ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.dark)
|
||||||
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
|
scaffoldBackgroundColor: Colors.grey[900], // Dark background
|
||||||
|
appBarTheme: AppBarTheme(
|
||||||
|
backgroundColor: Colors.grey[850], // Darker app bar
|
||||||
|
foregroundColor: Colors.white, // Title and icons
|
||||||
|
),
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey), // Lighter border for dark theme
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.blue.shade300, width: 2.0),
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(color: Colors.grey[400]), // Lighter label for dark theme
|
||||||
|
// Ensure content padding is applied if needed, or use default
|
||||||
|
// contentPadding: const EdgeInsets.all(8.0), // This was in TextField, maybe move to theme?
|
||||||
|
),
|
||||||
|
// Ensure text field text color is readable
|
||||||
|
textTheme: const TextTheme(
|
||||||
|
bodyMedium: TextStyle(color: Colors.white), // Default text style
|
||||||
|
// Define other text styles as needed
|
||||||
|
),
|
||||||
|
// Define icon theme for app bar if needed, though foregroundColor often handles it
|
||||||
|
// iconTheme: const IconThemeData(color: Colors.white),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Journaler',
|
title: 'Journaler',
|
||||||
theme: ThemeData(
|
theme: lightTheme, // Use the light theme definition
|
||||||
primarySwatch: Colors.blue,
|
darkTheme: darkTheme, // Use the dark theme definition
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
themeMode: ThemeMode.system, // Automatically switch based on system settings
|
||||||
),
|
|
||||||
home: const MainPage(),
|
home: const MainPage(),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
);
|
);
|
||||||
@@ -275,8 +325,8 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
readOnly: true, // Make it non-editable
|
readOnly: true, // Make it non-editable
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Previous Entry',
|
labelText: 'Previous Entry',
|
||||||
border: OutlineInputBorder(),
|
// border: OutlineInputBorder(), // Handled by theme
|
||||||
contentPadding: EdgeInsets.all(8.0),
|
// contentPadding: EdgeInsets.all(8.0), // Handled by theme or default
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -290,8 +340,8 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
autofocus: true, // Focus here when window appears
|
autofocus: true, // Focus here when window appears
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Current Entry (What\'s on your mind?)',
|
labelText: 'Current Entry (What\'s on your mind?)',
|
||||||
border: OutlineInputBorder(),
|
// border: OutlineInputBorder(), // Handled by theme
|
||||||
contentPadding: EdgeInsets.all(8.0),
|
// contentPadding: EdgeInsets.all(8.0), // Handled by theme or default
|
||||||
),
|
),
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
// Optional: Add auto-save logic here if desired
|
// Optional: Add auto-save logic here if desired
|
||||||
@@ -311,8 +361,8 @@ class _MainPageState extends State<MainPage> with WindowListener {
|
|||||||
expands: true,
|
expands: true,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Todo List',
|
labelText: 'Todo List',
|
||||||
border: OutlineInputBorder(),
|
// border: OutlineInputBorder(), // Handled by theme
|
||||||
contentPadding: EdgeInsets.all(8.0),
|
// contentPadding: EdgeInsets.all(8.0), // Handled by theme or default
|
||||||
),
|
),
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
// Optional: Auto-save Todo list changes
|
// Optional: Auto-save Todo list changes
|
||||||
|
Reference in New Issue
Block a user