backgroundcolor migration

This commit is contained in:
NicKoehler 2023-02-23 16:49:31 +01:00
parent 37deaf67cc
commit ab9acc76fc
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58
13 changed files with 42 additions and 36 deletions

View File

@ -45,9 +45,10 @@ var isWeb = false;
var isWebDesktop = false;
var version = "";
int androidVersion = 0;
/// Incriment count for textureId.
int _textureId = 0;
int get newTextureId => _textureId ++;
int get newTextureId => _textureId++;
final textureRenderer = TextureRgbaRenderer();
/// only available for Windows target
@ -165,7 +166,6 @@ class MyTheme {
static ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
backgroundColor: Color(0xFFEEEEEE),
hoverColor: Color.fromARGB(255, 224, 224, 224),
scaffoldBackgroundColor: Color(0xFFFFFFFF),
textTheme: const TextTheme(
@ -177,7 +177,6 @@ class MyTheme {
labelLarge: TextStyle(fontSize: 16.0, color: MyTheme.accent80)),
cardColor: Color(0xFFEEEEEE),
hintColor: Color(0xFFAAAAAA),
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
tabBarTheme: const TabBarTheme(
labelColor: Colors.black87,
@ -190,6 +189,10 @@ class MyTheme {
style: ButtonStyle(splashFactory: NoSplash.splashFactory),
)
: null,
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(
brightness: Brightness.light,
background: Color(0xFFEEEEEE),
),
).copyWith(
extensions: <ThemeExtension<dynamic>>[
ColorThemeExtension.light,
@ -198,7 +201,6 @@ class MyTheme {
);
static ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
backgroundColor: Color(0xFF24252B),
hoverColor: Color.fromARGB(255, 45, 46, 53),
scaffoldBackgroundColor: Color(0xFF18191E),
textTheme: const TextTheme(
@ -209,7 +211,6 @@ class MyTheme {
labelLarge: TextStyle(
fontSize: 16.0, fontWeight: FontWeight.bold, color: accent80)),
cardColor: Color(0xFF24252B),
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
tabBarTheme: const TabBarTheme(
labelColor: Colors.white70,
@ -227,6 +228,10 @@ class MyTheme {
: null,
checkboxTheme:
const CheckboxThemeData(checkColor: MaterialStatePropertyAll(dark)),
colorScheme: ColorScheme.fromSwatch(
brightness: Brightness.dark,
primarySwatch: Colors.blue,
).copyWith(background: Color(0xFF24252B)),
).copyWith(
extensions: <ThemeExtension<dynamic>>[
ColorThemeExtension.dark,

View File

@ -75,7 +75,8 @@ class ChatPage extends StatelessWidget implements PageShape {
hintText:
"${translate('Write a message')}...",
filled: true,
fillColor: Theme.of(context).backgroundColor,
fillColor:
Theme.of(context).colorScheme.background,
contentPadding: EdgeInsets.all(10),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
@ -88,7 +89,8 @@ class ChatPage extends StatelessWidget implements PageShape {
: defaultInputDecoration(
hintText:
"${translate('Write a message')}...",
fillColor: Theme.of(context).backgroundColor),
fillColor:
Theme.of(context).colorScheme.background),
sendButtonBuilder: defaultSendButton(
padding: EdgeInsets.symmetric(
horizontal: 6, vertical: 0),

View File

@ -170,8 +170,8 @@ class _PeerCardState extends State<_PeerCard>
),
Expanded(
child: Container(
decoration:
BoxDecoration(color: Theme.of(context).backgroundColor),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background),
child: Row(
children: [
Expanded(
@ -266,7 +266,7 @@ class _PeerCardState extends State<_PeerCard>
),
),
Container(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -1090,7 +1090,7 @@ class ActionMore extends StatelessWidget {
radius: 14,
backgroundColor: _hover.value
? Theme.of(context).scaffoldBackgroundColor
: Theme.of(context).backgroundColor,
: Theme.of(context).colorScheme.background,
child: Icon(Icons.more_vert,
size: 18,
color: _hover.value

View File

@ -156,7 +156,7 @@ class _PeerTabPageState extends State<PeerTabPage>
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: model.currentTab == t
? Theme.of(context).backgroundColor
? Theme.of(context).colorScheme.background
: null,
borderRadius: BorderRadius.circular(isDesktop ? 2 : 6),
),
@ -231,7 +231,8 @@ class _PeerTabPageState extends State<PeerTabPage>
Widget _createPeerViewTypeSwitch(BuildContext context) {
final textColor = Theme.of(context).textTheme.titleLarge?.color;
final activeDeco = BoxDecoration(color: Theme.of(context).backgroundColor);
final activeDeco =
BoxDecoration(color: Theme.of(context).colorScheme.background);
return Row(
children: [PeerUiType.grid, PeerUiType.list]
.map((type) => Obx(
@ -351,7 +352,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
return Container(
width: 120,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(6),
),
child: Obx(() => Row(

View File

@ -164,7 +164,7 @@ class _ConnectionPageState extends State<ConnectionPage>
width: 320 + 20 * 2,
padding: const EdgeInsets.fromLTRB(20, 24, 20, 22),
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: const BorderRadius.all(Radius.circular(13)),
),
child: Ink(

View File

@ -71,7 +71,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
value: gFFI.serverModel,
child: Container(
width: 200,
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController,
child: SingleChildScrollView(
@ -185,7 +185,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
radius: 15,
backgroundColor: hover.value
? Theme.of(context).scaffoldBackgroundColor
: Theme.of(context).backgroundColor,
: Theme.of(context).colorScheme.background,
child: Icon(
Icons.more_vert_outlined,
size: 20,

View File

@ -108,7 +108,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
body: Row(
children: <Widget>[
SizedBox(

View File

@ -65,7 +65,7 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
Widget build(BuildContext context) {
final tabWidget = Container(
child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab(
controller: tabController,
tail: ActionIcon(

View File

@ -91,7 +91,7 @@ class _PortForwardPageState extends State<PortForwardPage>
Flexible(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
border: Border.all(width: 1, color: MyTheme.border)),
child:
widget.isRDP ? buildRdp(context) : buildTunnel(context),
@ -134,7 +134,7 @@ class _PortForwardPageState extends State<PortForwardPage>
return Theme(
data: Theme.of(context)
.copyWith(backgroundColor: Theme.of(context).backgroundColor),
.copyWith(backgroundColor: Theme.of(context).colorScheme.background),
child: Obx(() => ListView.builder(
controller: ScrollController(),
itemCount: pfs.length + 2,
@ -169,7 +169,8 @@ class _PortForwardPageState extends State<PortForwardPage>
return Container(
height: _kRowHeight,
decoration: BoxDecoration(color: Theme.of(context).backgroundColor),
decoration:
BoxDecoration(color: Theme.of(context).colorScheme.background),
child: Row(children: [
buildTunnelInputCell(context,
controller: localPortController,
@ -229,7 +230,7 @@ class _PortForwardPageState extends State<PortForwardPage>
borderSide: BorderSide(color: MyTheme.color(context).border!)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: MyTheme.color(context).border!)),
fillColor: Theme.of(context).backgroundColor,
fillColor: Theme.of(context).colorScheme.background,
contentPadding: const EdgeInsets.all(10),
hintText: hint,
hintStyle:
@ -251,7 +252,7 @@ class _PortForwardPageState extends State<PortForwardPage>
? MyTheme.currentThemeMode() == ThemeMode.dark
? const Color(0xFF202020)
: const Color(0xFFF4F5F6)
: Theme.of(context).backgroundColor),
: Theme.of(context).colorScheme.background),
child: Row(children: [
text(pf.localPort.toString()),
const SizedBox(width: _kColumn1Width),
@ -293,7 +294,7 @@ class _PortForwardPageState extends State<PortForwardPage>
).marginOnly(left: _kTextLeftMargin));
return Theme(
data: Theme.of(context)
.copyWith(backgroundColor: Theme.of(context).backgroundColor),
.copyWith(backgroundColor: Theme.of(context).colorScheme.background),
child: ListView.builder(
controller: ScrollController(),
itemCount: 2,
@ -312,8 +313,8 @@ class _PortForwardPageState extends State<PortForwardPage>
} else {
return Container(
height: _kRowHeight,
decoration:
BoxDecoration(color: Theme.of(context).backgroundColor),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background),
child: Row(children: [
Expanded(
child: Align(

View File

@ -96,7 +96,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab(
controller: tabController,
onWindowCloseButton: () async {

View File

@ -225,7 +225,7 @@ class _RemotePageState extends State<RemotePage>
Widget buildBody(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
/// the Overlay key will be set with _blockableOverlayState in BlockableOverlay
/// see override build() in [BlockableOverlay]

View File

@ -141,7 +141,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
width: stateGlobal.windowBorderWidth.value),
),
child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab(
controller: tabController,
onWindowCloseButton: handleWindowCloseButton,

View File

@ -49,10 +49,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
@override
void onWindowClose() {
Future.wait([
gFFI.serverModel.closeAll(),
gFFI.close()
]).then((_) {
Future.wait([gFFI.serverModel.closeAll(), gFFI.close()]).then((_) {
if (Platform.isMacOS) {
RdPlatformChannel.instance.terminate();
} else {
@ -82,7 +79,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
decoration: BoxDecoration(
border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -189,7 +186,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
windowManager.startDragging();
},
child: Container(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
),
),
),