@@ -2,14 +2,16 @@ import 'package:calc/components/buttons.dart';
22import 'package:calc/components/buttons/backspace.dart' ;
33import 'package:calc/components/buttons/text.dart' ;
44import 'package:calc/components/equal.dart' ;
5+ import 'package:calc/components/header.dart' ;
56import 'package:calc/components/numbers.dart' ;
67import 'package:calc/components/pad.dart' ;
78import 'package:calc/components/view.dart' ;
89import 'package:calc/database/buttons.dart' ;
910import 'package:calc/interface/history.dart' ;
11+ import 'package:calc/services/theme.dart' ;
1012import 'package:calc/services/vibration.dart' as vibration;
1113import 'package:flutter/material.dart' ;
12- import 'package:flutter/services .dart' ;
14+ import 'package:provider/provider .dart' ;
1315
1416class MainView extends StatefulWidget {
1517 @override
@@ -22,63 +24,66 @@ class _MainViewState extends State<MainView> {
2224
2325 @override
2426 Widget build (BuildContext context) {
25- SystemChrome .setSystemUIOverlayStyle (SystemUiOverlayStyle (
26- systemNavigationBarColor: Theme .of (context).primaryColor,
27- systemNavigationBarIconBrightness: Brightness .light,
28- statusBarColor: Theme .of (context).primaryColor,
29- statusBarBrightness: Brightness .light,
30- ));
31- return Scaffold (
32- backgroundColor: Theme .of (context).primaryColor,
33- body: SafeArea (
34- child: Row (
35- children: [
36- NumbersColumn (
37- onPressed: (String value) => this .pushToEntry (value),
38- ),
39- View (
40- child: Column (
41- children: [
42- Pad (
43- entry: entry,
44- histories: histories,
45- ),
46- Buttons (
47- count: 4 ,
48- children: buttons
49- .map (
50- (button) => ButtonText (
51- button,
52- onPress: () => this .pushToHistory (button),
27+ return Consumer <ThemeProvider >(
28+ builder: (context, theme, _) => Scaffold (
29+ backgroundColor: theme.data ().primaryColor,
30+ body: SafeArea (
31+ child: Row (
32+ children: [
33+ NumbersColumn (
34+ onPressed: (String value) => this .pushToEntry (value),
35+ ),
36+ View (
37+ color: theme.data ().backgroundColor,
38+ child: Column (
39+ children: [
40+ Header (),
41+ Pad (
42+ entry: entry,
43+ histories: histories,
44+ brightness: theme.data ().brightness,
45+ ),
46+ Buttons (
47+ count: 4 ,
48+ children: buttons
49+ .map (
50+ (button) => ButtonText (
51+ button,
52+ onPress: () => this .pushToHistory (button),
53+ brightness: theme.data ().brightness,
54+ ),
55+ )
56+ .toList (),
57+ ),
58+ Spacer (),
59+ Container (
60+ margin: EdgeInsets .symmetric (
61+ horizontal: 20 ,
62+ ),
63+ child: Row (
64+ children: [
65+ ButtonText (
66+ 'C' ,
67+ onPress: () => this .clear (),
68+ brightness: theme.data ().brightness,
69+ ),
70+ Spacer (),
71+ ButtonBackspace (
72+ brightness: theme.data ().brightness,
73+ onPress: () => this .backspace (),
5374 ),
54- )
55- .toList (),
56- ),
57- Spacer (),
58- Container (
59- margin: EdgeInsets .symmetric (
60- horizontal: 20 ,
75+ ],
76+ ),
6177 ),
62- child: Row (
63- children: [
64- ButtonText (
65- 'C' ,
66- onPress: () => this .clear (),
67- ),
68- Spacer (),
69- ButtonBackspace (
70- onPress: () => this .backspace (),
71- ),
72- ],
78+ EqualButton (
79+ color: theme.data ().primaryColor,
80+ onPressed: () => this .calculate (),
7381 ),
74- ),
75- EqualButton (
76- onPressed: () => this .calculate (),
77- ),
78- ],
82+ ],
83+ ),
7984 ),
80- ) ,
81- ] ,
85+ ] ,
86+ ) ,
8287 ),
8388 ),
8489 );
0 commit comments