Closed Myzel394 closed 1 year ago
Can you provide an example code that replicates this. The example project seems to work ok but there might be something else going on
I created a new Flutter project (using Flutter 3.10.0) and added this package using flutter pub add flutter_platform_widgets
and replaced MaterialApp
with PlatformApp
:
import 'package:flutter/material.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return PlatformApp(
title: 'Flutter Demo',
material: (_, __) => MaterialAppData(
theme: ThemeData(),
darkTheme: ThemeData.dark(),
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
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,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
I have published v3.3.4 that should fix this for you
Dark mode is not properly recognized when using version
^3.0.0
of this package and Flutter3.10
(when usingdarkTheme
andtheme
). Related to #401