mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 09:54:19 +01:00
set dark mode if necessary (works at android)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -136,6 +137,10 @@ class _WebViewComponent extends State<WebViewComponent>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
settings.incognito = widget.webInfo.incognitoMode;
|
settings.incognito = widget.webInfo.incognitoMode;
|
||||||
|
var themeData = Theme.of(context);
|
||||||
|
if (themeData.brightness == Brightness.dark) {
|
||||||
|
settings.forceDark = ForceDark.ON;
|
||||||
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
child: InAppWebView(
|
child: InAppWebView(
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ ThemeData getLightTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
|
brightness: Brightness.light,
|
||||||
// platform: TargetPlatform.iOS,
|
// platform: TargetPlatform.iOS,
|
||||||
primarySwatch: themeColor,
|
primarySwatch: themeColor,
|
||||||
colorScheme: ColorScheme.fromSeed(
|
colorScheme: ColorScheme.fromSeed(
|
||||||
@@ -410,6 +411,7 @@ ThemeData getDarkTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
|
brightness: Brightness.dark,
|
||||||
// platform: TargetPlatform.iOS,
|
// platform: TargetPlatform.iOS,
|
||||||
primarySwatch: themeColor,
|
primarySwatch: themeColor,
|
||||||
colorScheme: ColorScheme.fromSeed(
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
|||||||
Reference in New Issue
Block a user