mirror of
https://github.com/tonytins/bullseye.git
synced 2025-03-21 22:52:19 +00:00
Force light mode on iOS
For some reason text is black in dark mode on iOS.
This commit is contained in:
parent
0cf72ac778
commit
964e861450
1 changed files with 12 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
|
|
||||||
|
@ -10,18 +11,19 @@ import 'package:bullseye/game_model.dart';
|
||||||
void main() => runApp(BullsEyeApp());
|
void main() => runApp(BullsEyeApp());
|
||||||
|
|
||||||
class BullsEyeApp extends StatelessWidget {
|
class BullsEyeApp extends StatelessWidget {
|
||||||
|
Brightness currentBrightness = Brightness.light;
|
||||||
|
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations(
|
SystemChrome.setPreferredOrientations(
|
||||||
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
|
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
|
||||||
return MaterialApp(
|
return PlatformApp(
|
||||||
title: 'BullsEye',
|
title: 'BullsEye',
|
||||||
theme: ThemeData(
|
// For some reason text is black in dark mode on iOS
|
||||||
primarySwatch: Colors.blue,
|
cupertino: (_, __) => CupertinoAppData(
|
||||||
),
|
theme: CupertinoThemeData(brightness: Brightness.light)),
|
||||||
home: GamePage(title: 'BullsEye'),
|
home: GamePage(title: 'BullsEye'));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ class _GamePageState extends State<GamePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return PlatformScaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -66,7 +68,7 @@ class _GamePageState extends State<GamePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showAlert(BuildContext context) {
|
void _showAlert(BuildContext context) {
|
||||||
Widget okButton = TextButton(
|
Widget okButton = PlatformTextButton(
|
||||||
child: PlatformText("Awesome!"),
|
child: PlatformText("Awesome!"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -74,7 +76,7 @@ class _GamePageState extends State<GamePage> {
|
||||||
print("Awesome Pressed! $_alertIsVisable");
|
print("Awesome Pressed! $_alertIsVisable");
|
||||||
});
|
});
|
||||||
|
|
||||||
showDialog(
|
showPlatformDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return PlatformAlertDialog(
|
return PlatformAlertDialog(
|
||||||
|
|
Loading…
Add table
Reference in a new issue