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(),
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(
primaryColor: const Color(0xFF117cc1),
primaryColorLight: const Color(0xFF5dabf4),
primaryColorDark: const Color(0xFF0D5D91),
indicatorColor: const Color(0xFFFFFFFF),
),
*/
/*
theme: ThemeData(
brightness: Brightness.dark,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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