-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
I tried setting
theme: ThemeData(brightness: Brightness.dark), on the materialApp, it's not working.
I also tried using evalpad with this code::
import 'package:flutter/material.dart';
Widget main() {
return MyApp();
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'flutter_eval demo',
theme: ThemeData(brightness: Brightness.dark),
darkTheme: ThemeData(brightness: Brightness.dark),
themeMode: ThemeMode.dark,
home: const MyHomePage(title: 'flutter_eval demo home page dark'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
_MyHomePageState();
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
)
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
But it still using light theme.
Metadata
Metadata
Assignees
Labels
No labels