Change some hard coded theme elements to dynamic. Added dark theme code.

This commit is contained in:
Anmol Gupta 2018-06-15 21:54:18 +05:30
parent 6476f79a82
commit f7b438824f
10 changed files with 42 additions and 14 deletions

View File

@ -61,12 +61,40 @@ class _InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
const AppLocalizationsDelegate(), const AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,
], ],
// light theme
theme: ThemeData().copyWith(
accentColor: Colors.lightBlueAccent,
primaryColor: const Color(0xFF117cc1),
primaryColorLight: const Color(0xFF5dabf4),
primaryColorDark: const Color(0xFF0D5D91),
indicatorColor: const Color(0xFFFFFFFF),
iconTheme: IconThemeData().copyWith(),
bottomAppBarColor: const Color(0xFF117cc1),
),
//dark theme
/*
theme: ThemeData.dark().copyWith(
accentColor: Colors.lightBlueAccent,
primaryColor: const Color(0xFF117cc1),
primaryColorLight: const Color(0xFF5dabf4),
primaryColorDark: const Color(0xFF0D5D91),
indicatorColor: const Color(0xFFFFFFFF),
iconTheme: IconThemeData().copyWith(color: Colors.white),
bottomAppBarColor: const Color(0xFF117cc1),
),
*/
/*
theme: ThemeData().copyWith( theme: ThemeData().copyWith(
primaryColor: const Color(0xFF117cc1), primaryColor: const Color(0xFF117cc1),
primaryColorLight: const Color(0xFF5dabf4), primaryColorLight: const Color(0xFF5dabf4),
primaryColorDark: const Color(0xFF0D5D91), primaryColorDark: const Color(0xFF0D5D91),
indicatorColor: const Color(0xFFFFFFFF), indicatorColor: const Color(0xFFFFFFFF),
), ),
*/
/* /*
theme: ThemeData( theme: ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,

View File

@ -30,7 +30,7 @@ class ActionMenuButton extends StatelessWidget {
value: EntityAction.restore, value: EntityAction.restore,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon(Icons.restore, color: Colors.grey[600]), Icon(Icons.restore,),
SizedBox(width: 15.0), SizedBox(width: 15.0),
Text(AppLocalization.of(context).restore), Text(AppLocalization.of(context).restore),
], ],
@ -40,7 +40,7 @@ class ActionMenuButton extends StatelessWidget {
value: EntityAction.archive, value: EntityAction.archive,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon(Icons.archive, color: Colors.grey[600]), Icon(Icons.archive,),
SizedBox(width: 15.0), SizedBox(width: 15.0),
Text(AppLocalization.of(context).archive), Text(AppLocalization.of(context).archive),
], ],
@ -50,7 +50,7 @@ class ActionMenuButton extends StatelessWidget {
value: EntityAction.delete, value: EntityAction.delete,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon(Icons.delete, color: Colors.grey[600]), Icon(Icons.delete,),
SizedBox(width: 15.0), SizedBox(width: 15.0),
Text(AppLocalization.of(context).delete), Text(AppLocalization.of(context).delete),
], ],

View File

@ -46,7 +46,7 @@ class _AppBottomBarState extends State<AppBottomBar> {
converter: (Store<AppState> store) => store.state.getListState(widget.entityType).stateFilters, converter: (Store<AppState> store) => store.state.getListState(widget.entityType).stateFilters,
builder: (BuildContext context, stateFilters) { builder: (BuildContext context, stateFilters) {
return Container( return Container(
color: Colors.grey[200], color: Theme.of(context).backgroundColor, //Colors.grey[200],
child: new Column(mainAxisSize: MainAxisSize.min, children: <Widget>[ child: new Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
Column( Column(
children: EntityState.values.map<Widget>((state) { children: EntityState.values.map<Widget>((state) {
@ -101,7 +101,7 @@ class _AppBottomBarState extends State<AppBottomBar> {
converter: (Store<AppState> store) => store.state.getListState(widget.entityType), converter: (Store<AppState> store) => store.state.getListState(widget.entityType),
builder: (BuildContext context, listUIState) { builder: (BuildContext context, listUIState) {
return Container( return Container(
color: Colors.grey[200], color: Theme.of(context).backgroundColor,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: widget.sortFields.map((sortField) { children: widget.sortFields.map((sortField) {
@ -131,6 +131,7 @@ class _AppBottomBarState extends State<AppBottomBar> {
}; };
return new BottomAppBar( return new BottomAppBar(
color: Theme.of(context).bottomAppBarColor,
hasNotch: true, hasNotch: true,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -138,11 +139,13 @@ class _AppBottomBarState extends State<AppBottomBar> {
tooltip: AppLocalization.of(context).sort, tooltip: AppLocalization.of(context).sort,
icon: Icon(Icons.sort_by_alpha), icon: Icon(Icons.sort_by_alpha),
onPressed: _showSortSheet, onPressed: _showSortSheet,
color: Colors.white,
), ),
IconButton( IconButton(
tooltip: AppLocalization.of(context).filter, tooltip: AppLocalization.of(context).filter,
icon: Icon(Icons.filter_list), icon: Icon(Icons.filter_list),
onPressed: _showFilterSheet, onPressed: _showFilterSheet,
color: Colors.white,
), ),
], ],
), ),

View File

@ -63,7 +63,7 @@ class ClientScreen extends StatelessWidget {
.of(context) .of(context)
.push(MaterialPageRoute(builder: (_) => ClientEditScreen())); .push(MaterialPageRoute(builder: (_) => ClientEditScreen()));
}, },
child: Icon(Icons.add), child: Icon(Icons.add, color: Colors.white,),
tooltip: localization.newClient, tooltip: localization.newClient,
), ),
); );

View File

@ -83,7 +83,6 @@ class ClientEditContactsState extends State<ClientEditContacts>
child: RaisedButton( child: RaisedButton(
elevation: 4.0, elevation: 4.0,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
textColor: Theme.of(context).secondaryHeaderColor,
child: Text(localization.addContact.toUpperCase()), child: Text(localization.addContact.toUpperCase()),
onPressed: _onAddPressed, onPressed: _onAddPressed,
), ),

View File

@ -98,7 +98,7 @@ class _ClientViewState extends State<ClientView>
]), ]),
); );
}, },
child: Icon(Icons.add), child: Icon(Icons.add, color: Colors.white,),
tooltip: localization.create, tooltip: localization.create,
), ),
); );

View File

@ -110,7 +110,6 @@ class ClientOverview extends StatelessWidget {
height: 1.0, height: 1.0,
), ),
Container( Container(
color: Colors.white,
child: Material( child: Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: ListTile( child: ListTile(
@ -125,7 +124,6 @@ class ClientOverview extends StatelessWidget {
height: 1.0, height: 1.0,
), ),
Container( Container(
color: Colors.white,
child: Material( child: Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: ListTile( child: ListTile(

View File

@ -97,7 +97,7 @@ class DashboardRow extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text(this.title, Text(this.title,
style: TextStyle(color: Colors.grey[700])), style: TextStyle()),
Text(this.isMoney Text(this.isMoney
? "\$" + this.amount.toStringAsFixed(2) ? "\$" + this.amount.toStringAsFixed(2)
: this.amount.toString(), : this.amount.toString(),
@ -140,7 +140,7 @@ class DashboardColumn extends StatelessWidget {
Center(child: ColorIcon(this.icon, this.color)), Center(child: ColorIcon(this.icon, this.color)),
SizedBox(height: 18.0), SizedBox(height: 18.0),
Text(this.title, Text(this.title,
style: TextStyle(color: Colors.grey[700])), style: TextStyle()),
Text(this.isMoney Text(this.isMoney
? "\$" + this.amount.toStringAsFixed(2) ? "\$" + this.amount.toStringAsFixed(2)
: this.amount.toString(), : this.amount.toString(),

View File

@ -60,7 +60,7 @@ class InvoiceScreen extends StatelessWidget {
.of(context) .of(context)
.push(MaterialPageRoute(builder: (_) => InvoiceEditScreen())); .push(MaterialPageRoute(builder: (_) => InvoiceEditScreen()));
}, },
child: Icon(Icons.add), child: Icon(Icons.add,color: Colors.white,),
tooltip: localization.newInvoice, tooltip: localization.newInvoice,
), ),
); );

View File

@ -60,7 +60,7 @@ class ProductScreen extends StatelessWidget {
.of(context) .of(context)
.push(MaterialPageRoute(builder: (_) => ProductEditScreen())); .push(MaterialPageRoute(builder: (_) => ProductEditScreen()));
}, },
child: Icon(Icons.add), child: Icon(Icons.add,color: Colors.white,),
tooltip: localization.newProduct, tooltip: localization.newProduct,
), ),
); );