Skip to content

Commit 28c1e21

Browse files
committed
Adjusted some ThemeData.
1 parent 054b92b commit 28c1e21

File tree

4 files changed

+110
-139
lines changed

4 files changed

+110
-139
lines changed

lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class MyApp extends StatelessWidget {
4545
Widget build(BuildContext context) {
4646
return MaterialApp(
4747
title: 'Mobileraker',
48-
theme: getLightTheme(),
49-
darkTheme: getDarkTheme(),
48+
theme: getLightTheme(context),
49+
darkTheme: getDarkTheme(context),
5050
navigatorKey: StackedService.navigatorKey,
5151
onGenerateRoute: StackedRouter().onGenerateRoute,
5252
localizationsDelegates: [

lib/ui/theme_setup.dart

+32-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart';
23

34
const int darkRed = 0xffb21818;
@@ -14,7 +15,6 @@ var redish = MaterialColor(darkRed, <int, Color>{
1415
900: Color(darkRed),
1516
});
1617

17-
1818
var brownish = MaterialColor(0xffd2a855, <int, Color>{
1919
50: Color(0xfff6f0e1),
2020
100: Color(0xffebd9b3),
@@ -67,12 +67,35 @@ var tealy = MaterialColor(0xff18b2b2, <int, Color>{
6767
900: Color(0xff004941),
6868
});
6969

70-
ThemeData getLightTheme() => ThemeData(
71-
primarySwatch: Colors.blue,
72-
);
70+
ThemeData getLightTheme(BuildContext context) {
71+
var themeData = ThemeData(
72+
primarySwatch: Colors.blue,
73+
);
74+
75+
return themeData.copyWith(
76+
elevatedButtonTheme: ElevatedButtonThemeData(
77+
style: ElevatedButton.styleFrom(
78+
padding: EdgeInsets.all(8),
79+
shape: RoundedRectangleBorder(
80+
borderRadius: BorderRadius.all(Radius.circular(5.0))))),
81+
);
7382

74-
ThemeData getDarkTheme() => ThemeData(
75-
colorScheme: ColorScheme.fromSwatch(
76-
primarySwatch: brownish,
77-
brightness: Brightness.dark,
78-
accentColor: Color(darkRed)),);
83+
}
84+
85+
ThemeData getDarkTheme(BuildContext context) {
86+
var colorScheme = ColorScheme.fromSwatch(
87+
primarySwatch: brownish,
88+
primaryColorDark: Colors.grey[900]!,
89+
brightness: Brightness.dark,
90+
accentColor: Color(darkRed));
91+
return ThemeData(
92+
elevatedButtonTheme: ElevatedButtonThemeData(
93+
style: ElevatedButton.styleFrom(
94+
primary: colorScheme.secondary,
95+
onPrimary: colorScheme.onSecondary,
96+
padding: EdgeInsets.all(8),
97+
shape: RoundedRectangleBorder(
98+
borderRadius: BorderRadius.all(Radius.circular(5.0))))),
99+
colorScheme: colorScheme,
100+
);
101+
}

lib/ui/views/overview/tabs/control_tab.dart

+10-37
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ class _FanTile extends StatelessWidget {
146146

147147
@override
148148
Widget build(BuildContext context) {
149-
var col = Theme.of(context).primaryColorLight;
150-
151149
double icoSize = 30;
152150
var w = speed > 0
153151
? SpinningFan(size: icoSize)
@@ -158,7 +156,6 @@ class _FanTile extends StatelessWidget {
158156

159157
return CardWithButton(
160158
width: width,
161-
backgroundColor: col,
162159
child: Row(
163160
mainAxisAlignment: MainAxisAlignment.spaceBetween,
164161
children: [
@@ -241,38 +238,24 @@ class ExtruderControlCard extends ViewModelWidget<ControlTabViewModel> {
241238
children: [
242239
Container(
243240
margin: const EdgeInsets.all(5),
244-
child: TextButton.icon(
241+
child: ElevatedButton.icon(
245242
onPressed:
246243
model.canUsePrinter ? model.onDeRetractBtn : null,
247244
icon: Icon(FlutterIcons.plus_ant),
248245
label:
249246
Text('pages.overview.control.extrude_card.extrude')
250247
.tr(),
251-
style: TextButton.styleFrom(
252-
backgroundColor:
253-
Theme.of(context).colorScheme.secondary,
254-
shape: RoundedRectangleBorder(
255-
borderRadius:
256-
BorderRadius.all(Radius.circular(5.0))),
257-
primary: textBtnColor),
258248
),
259249
),
260250
Container(
261251
margin: const EdgeInsets.all(5),
262-
child: TextButton.icon(
252+
child: ElevatedButton.icon(
263253
onPressed:
264254
model.canUsePrinter ? model.onRetractBtn : null,
265255
icon: Icon(FlutterIcons.minus_ant),
266256
label:
267257
Text('pages.overview.control.extrude_card.retract')
268258
.tr(),
269-
style: TextButton.styleFrom(
270-
backgroundColor:
271-
Theme.of(context).colorScheme.secondary,
272-
shape: RoundedRectangleBorder(
273-
borderRadius:
274-
BorderRadius.all(Radius.circular(5.0))),
275-
primary: textBtnColor),
276259
),
277260
),
278261
],
@@ -330,9 +313,12 @@ class GcodeMacroCard extends ViewModelWidget<ControlTabViewModel> {
330313
),
331314
Padding(
332315
padding: const EdgeInsets.fromLTRB(15, 0, 15, 15),
333-
child: Wrap(
334-
spacing: 5.0,
335-
children: _generateGCodeChips(context, model),
316+
child: ChipTheme(
317+
data: ChipThemeData(labelStyle: TextStyle(color: Colors.white),deleteIconColor: Colors.white),
318+
child: Wrap(
319+
spacing: 5.0,
320+
children: _generateGCodeChips(context, model),
321+
),
336322
),
337323
),
338324
],
@@ -453,11 +439,8 @@ class _PinTile extends StatelessWidget {
453439

454440
@override
455441
Widget build(BuildContext context) {
456-
var col = Theme.of(context).primaryColorLight;
457-
458442
return CardWithButton(
459443
width: width,
460-
backgroundColor: col,
461444
child: Column(
462445
crossAxisAlignment: CrossAxisAlignment.start,
463446
children: [
@@ -496,27 +479,17 @@ class MultipliersCard extends ViewModelWidget<ControlTabViewModel> {
496479
child: Row(
497480
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
498481
children: <Widget>[
499-
TextButton(
482+
ElevatedButton(
500483
onPressed:
501484
model.canUsePrinter ? model.onEditSpeedMultiplier : null,
502485
child: Text(
503486
'${tr('pages.overview.general.print_card.speed')}: ${model.speedMultiplier}%'),
504-
style: TextButton.styleFrom(
505-
backgroundColor: Theme.of(context).colorScheme.secondary,
506-
shape: RoundedRectangleBorder(
507-
borderRadius: BorderRadius.all(Radius.circular(5.0))),
508-
primary: textBtnColor),
509487
),
510-
TextButton(
488+
ElevatedButton(
511489
onPressed:
512490
model.canUsePrinter ? model.onEditFlowMultiplier : null,
513491
child: Text(
514492
'${tr('pages.overview.control.multipl_card.flow')}: ${model.flowMultiplier}%'),
515-
style: TextButton.styleFrom(
516-
backgroundColor: Theme.of(context).colorScheme.secondary,
517-
shape: RoundedRectangleBorder(
518-
borderRadius: BorderRadius.all(Radius.circular(5.0))),
519-
primary: textBtnColor),
520493
),
521494
],
522495
),

0 commit comments

Comments
 (0)