Enable prefer_const_constructors

This commit is contained in:
Vishesh Handa
2019-10-20 01:11:01 +01:00
parent 5d69dd9de2
commit ffc0af12a3
21 changed files with 97 additions and 99 deletions

View File

@ -82,8 +82,8 @@ linter:
# - parameter_assignments # we do this commonly # - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation - prefer_adjacent_string_concatenation
- prefer_collection_literals - prefer_collection_literals
# - prefer_conditional_assignment # not yet tested - prefer_conditional_assignment
# - prefer_const_constructors - prefer_const_constructors
# - prefer_constructors_over_static_methods # not yet tested # - prefer_constructors_over_static_methods # not yet tested
- prefer_contains - prefer_contains
- prefer_equal_for_default_values - prefer_equal_for_default_values
@ -107,7 +107,7 @@ linter:
- unnecessary_brace_in_string_interps - unnecessary_brace_in_string_interps
# - unnecessary_const # - unnecessary_const
- unnecessary_getters_setters - unnecessary_getters_setters
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498 - unnecessary_lambdas
- unnecessary_new - unnecessary_new
- unnecessary_null_aware_assignments - unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators - unnecessary_null_in_if_null_operators

View File

@ -113,7 +113,7 @@ class JournalApp extends StatelessWidget {
} }
return MaterialApp( return MaterialApp(
key: ValueKey("App"), key: const ValueKey("App"),
title: 'GitJournal', title: 'GitJournal',
theme: themeData, theme: themeData,
navigatorObservers: <NavigatorObserver>[JournalApp.observer], navigatorObservers: <NavigatorObserver>[JournalApp.observer],

View File

@ -15,7 +15,7 @@ class GitApp extends StatelessWidget {
home: Scaffold( home: Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: Text('Git Test'), title: const Text('Git Test'),
), ),
body: Column( body: Column(
children: _buildGitButtons(), children: _buildGitButtons(),
@ -48,12 +48,12 @@ class GitApp extends StatelessWidget {
return <Widget>[ return <Widget>[
RaisedButton( RaisedButton(
child: Text("Generate Keys"), child: const Text("Generate Keys"),
onPressed: () { onPressed: () {
generateSSHKeys(comment: "Git Sample App"); generateSSHKeys(comment: "Git Sample App");
}), }),
RaisedButton( RaisedButton(
child: Text("Git Clone"), child: const Text("Git Clone"),
onPressed: () async { onPressed: () async {
try { try {
await GitRepo.clone(basePath, cloneUrl); await GitRepo.clone(basePath, cloneUrl);
@ -65,25 +65,25 @@ class GitApp extends StatelessWidget {
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Pull"), child: const Text("Git Pull"),
onPressed: () async { onPressed: () async {
gitRepo.pull(); gitRepo.pull();
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Add"), child: const Text("Git Add"),
onPressed: () async { onPressed: () async {
gitRepo.add("."); gitRepo.add(".");
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Push"), child: const Text("Git Push"),
onPressed: () async { onPressed: () async {
gitRepo.push(); gitRepo.push();
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Commit"), child: const Text("Git Commit"),
onPressed: () async { onPressed: () async {
gitRepo.commit( gitRepo.commit(
message: "Default message from GitJournal", message: "Default message from GitJournal",
@ -92,13 +92,13 @@ class GitApp extends StatelessWidget {
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Reset Last"), child: const Text("Git Reset Last"),
onPressed: () async { onPressed: () async {
gitRepo.resetLast(); gitRepo.resetLast();
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Git Migrate"), child: const Text("Git Migrate"),
onPressed: () async { onPressed: () async {
var baseGitPath = await getGitBaseDirectory(); var baseGitPath = await getGitBaseDirectory();
await migrateGitRepo( await migrateGitRepo(

View File

@ -72,9 +72,7 @@ class Note implements Comparable<Note> {
} }
} }
if (_created == null) { _created ??= DateTime(0, 0, 0, 0, 0, 0, 0, 0);
_created = DateTime(0, 0, 0, 0, 0, 0, 0, 0);
}
} }
bool hasValidDate() { bool hasValidDate() {

View File

@ -35,17 +35,17 @@ class OAuthAppState extends State<OAuthApp> {
title: 'OAuth App', title: 'OAuth App',
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('OAuth Test'), title: const Text('OAuth Test'),
), ),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
RaisedButton( RaisedButton(
child: Text("Open OAuth URL"), child: const Text("Open OAuth URL"),
onPressed: () { onPressed: () {
githost.launchOAuthScreen(); githost.launchOAuthScreen();
}, },
), ),
RaisedButton( RaisedButton(
child: Text("List Repos"), child: const Text("List Repos"),
onPressed: () async { onPressed: () async {
try { try {
var repos = await githost.listRepos(); var repos = await githost.listRepos();
@ -58,7 +58,7 @@ class OAuthAppState extends State<OAuthApp> {
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Create Repo"), child: const Text("Create Repo"),
onPressed: () async { onPressed: () async {
try { try {
var repo = await githost.createRepo("journal_test2"); var repo = await githost.createRepo("journal_test2");
@ -69,7 +69,7 @@ class OAuthAppState extends State<OAuthApp> {
}, },
), ),
RaisedButton( RaisedButton(
child: Text("Add Deploy Key"), child: const Text("Add Deploy Key"),
onPressed: () async { onPressed: () async {
try { try {
await githost.addDeployKey(key, "vhanda/journal_test2"); await githost.addDeployKey(key, "vhanda/journal_test2");

View File

@ -140,24 +140,24 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
'We need permission to perform the following steps:', 'We need permission to perform the following steps:',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
// Step 1 // Step 1
Text( Text(
"1. Create a new private repo called 'journal' or use the existing one", "1. Create a new private repo called 'journal' or use the existing one",
style: Theme.of(context).textTheme.body2, style: Theme.of(context).textTheme.body2,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
Text( Text(
"2. Generate an SSH Key on this device", "2. Generate an SSH Key on this device",
style: Theme.of(context).textTheme.body2, style: Theme.of(context).textTheme.body2,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
Text( Text(
"3. Add the key as a deploy key with write access to the created repo", "3. Add the key as a deploy key with write access to the created repo",
style: Theme.of(context).textTheme.body2, style: Theme.of(context).textTheme.body2,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
GitHostSetupButton( GitHostSetupButton(
text: "Authorize GitJournal", text: "Authorize GitJournal",

View File

@ -83,12 +83,12 @@ class GitCloneUrlPageState extends State<GitCloneUrlPage> {
style: Theme.of(context).textTheme.headline, style: Theme.of(context).textTheme.headline,
), ),
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: inputForm, child: inputForm,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Next", text: "Next",
onPressed: formSubmitted, onPressed: formSubmitted,
@ -178,28 +178,28 @@ class GitCloneUrlKnownProviderPageState
'Please create a new git repository -', 'Please create a new git repository -',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
// Step 1 // Step 1
Text( Text(
'1. Go to the website, create a repo and copy its git clone URL', '1. Go to the website, create a repo and copy its git clone URL',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Open Create New Repo Webpage", text: "Open Create New Repo Webpage",
onPressed: widget.launchCreateUrlPage, onPressed: widget.launchCreateUrlPage,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
// Step 2 // Step 2
Text( Text(
'2. Enter the Git clone URL', '2. Enter the Git clone URL',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
inputForm, inputForm,
SizedBox(height: 16.0), const SizedBox(height: 16.0),
GitHostSetupButton( GitHostSetupButton(
text: "Next", text: "Next",
onPressed: formSubmitted, onPressed: formSubmitted,

View File

@ -24,12 +24,12 @@ class GitHostSetupFolderPage extends StatelessWidget {
'Would you like to store your journal entries in an existing folder?', 'Would you like to store your journal entries in an existing folder?',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
FolderListWidget( FolderListWidget(
folders: folders, folders: folders,
onSelected: subFolderSelected, onSelected: subFolderSelected,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
GitHostSetupButton( GitHostSetupButton(
text: "Ignore", text: "Ignore",
onPressed: rootFolderSelected, onPressed: rootFolderSelected,

View File

@ -15,9 +15,9 @@ class GitHostSetupLoadingPage extends StatelessWidget {
style: Theme.of(context).textTheme.display1, style: Theme.of(context).textTheme.display1,
), ),
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
Padding( const Padding(
padding: const EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: CircularProgressIndicator( child: CircularProgressIndicator(
value: null, value: null,
), ),

View File

@ -281,7 +281,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
), ),
], ],
), ),
padding: EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
); );
var scaffold = Scaffold( var scaffold = Scaffold(
@ -292,7 +292,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
InkWell( InkWell(
child: Container( child: Container(
child: Icon(Icons.arrow_back, size: 32.0), child: Icon(Icons.arrow_back, size: 32.0),
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
), ),
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
), ),
@ -505,7 +505,7 @@ class GitHostChoicePage extends StatelessWidget {
"Select a Git Hosting Provider -", "Select a Git Hosting Provider -",
style: Theme.of(context).textTheme.headline, style: Theme.of(context).textTheme.headline,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
GitHostSetupButton( GitHostSetupButton(
text: "GitHub", text: "GitHub",
iconUrl: 'assets/icon/github-icon.png', iconUrl: 'assets/icon/github-icon.png',
@ -513,7 +513,7 @@ class GitHostChoicePage extends StatelessWidget {
onKnownGitHost(GitHostType.GitHub); onKnownGitHost(GitHostType.GitHub);
}, },
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "GitLab", text: "GitLab",
iconUrl: 'assets/icon/gitlab-icon.png', iconUrl: 'assets/icon/gitlab-icon.png',
@ -521,7 +521,7 @@ class GitHostChoicePage extends StatelessWidget {
onKnownGitHost(GitHostType.GitLab); onKnownGitHost(GitHostType.GitLab);
}, },
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Custom", text: "Custom",
onPressed: () async { onPressed: () async {
@ -555,14 +555,14 @@ class GitHostAutoConfigureChoicePage extends StatelessWidget {
"How do you want to do this?", "How do you want to do this?",
style: Theme.of(context).textTheme.headline, style: Theme.of(context).textTheme.headline,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
GitHostSetupButton( GitHostSetupButton(
text: "Setup Automatically", text: "Setup Automatically",
onPressed: () { onPressed: () {
onDone(GitHostSetupType.Auto); onDone(GitHostSetupType.Auto);
}, },
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Let me do it manually", text: "Let me do it manually",
onPressed: () async { onPressed: () async {

View File

@ -32,40 +32,40 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
'In order to access this repository, this public key must be copied as a deploy key', 'In order to access this repository, this public key must be copied as a deploy key',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
// Step 1 // Step 1
Text( Text(
'1. Copy the key', '1. Copy the key',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
PublicKeyWidget(publicKey), PublicKeyWidget(publicKey),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Copy Key", text: "Copy Key",
onPressed: () => copyKeyFunction(context), onPressed: () => copyKeyFunction(context),
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
// Step 2 // Step 2
Text( Text(
'2. Open webpage, and paste the deploy key. Make sure it is given Write Access. ', '2. Open webpage, and paste the deploy key. Make sure it is given Write Access. ',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Open Deploy Key Webpage", text: "Open Deploy Key Webpage",
onPressed: openDeployKeyPage, onPressed: openDeployKeyPage,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
// Step 3 // Step 3
Text( Text(
'3. Try Cloning ..', '3. Try Cloning ..',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Clone Repo", text: "Clone Repo",
onPressed: doneFunction, onPressed: doneFunction,
@ -106,35 +106,35 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
'In order to access this repository, this public key must be copied as a deploy key', 'In order to access this repository, this public key must be copied as a deploy key',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
SizedBox(height: 32.0), const SizedBox(height: 32.0),
// Step 1 // Step 1
Text( Text(
'1. Copy the key', '1. Copy the key',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
PublicKeyWidget(publicKey), PublicKeyWidget(publicKey),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Copy Key", text: "Copy Key",
onPressed: () => copyKeyFunction(context), onPressed: () => copyKeyFunction(context),
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
// Step 2 // Step 2
Text( Text(
'2. Give this SSH Key access to the git repo. (You need to figure it out yourself)', '2. Give this SSH Key access to the git repo. (You need to figure it out yourself)',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
// Step 3 // Step 3
Text( Text(
'3. Try Cloning ..', '3. Try Cloning ..',
style: Theme.of(context).textTheme.subtitle, style: Theme.of(context).textTheme.subtitle,
), ),
SizedBox(height: 8.0), const SizedBox(height: 8.0),
GitHostSetupButton( GitHostSetupButton(
text: "Clone Repo", text: "Clone Repo",
onPressed: doneFunction, onPressed: doneFunction,

View File

@ -18,7 +18,7 @@ class HomeScreen extends StatelessWidget {
final appState = container.appState; final appState = container.appState;
var createButton = FloatingActionButton( var createButton = FloatingActionButton(
key: ValueKey("FAB"), key: const ValueKey("FAB"),
onPressed: () => _newPost(context), onPressed: () => _newPost(context),
child: Icon(Icons.add), child: Icon(Icons.add),
); );
@ -40,7 +40,7 @@ class HomeScreen extends StatelessWidget {
bool shouldShowBadge = bool shouldShowBadge =
!appState.remoteGitRepoConfigured && appState.hasJournalEntries; !appState.remoteGitRepoConfigured && appState.hasJournalEntries;
var appBarMenuButton = BadgeIconButton( var appBarMenuButton = BadgeIconButton(
key: ValueKey("DrawerButton"), key: const ValueKey("DrawerButton"),
icon: const Icon(Icons.menu), icon: const Icon(Icons.menu),
itemCount: shouldShowBadge ? 1 : 0, itemCount: shouldShowBadge ? 1 : 0,
onPressed: () { onPressed: () {
@ -51,7 +51,7 @@ class HomeScreen extends StatelessWidget {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
title: Text('GitJournal'), title: const Text('GitJournal'),
leading: appBarMenuButton, leading: appBarMenuButton,
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(

View File

@ -60,7 +60,7 @@ class NoteEditorState extends State<NoteEditor> {
appBar: AppBar( appBar: AppBar(
title: Text(title), title: Text(title),
leading: IconButton( leading: IconButton(
key: ValueKey("NewEntry"), key: const ValueKey("NewEntry"),
icon: Icon(Icons.check), icon: Icon(Icons.check),
onPressed: () { onPressed: () {
_saveNote(context); _saveNote(context);
@ -102,7 +102,7 @@ class NoteEditorState extends State<NoteEditor> {
), ),
PopupMenuItem<NoteEditorDropDownChoices>( PopupMenuItem<NoteEditorDropDownChoices>(
value: NoteEditorDropDownChoices.SwitchEditor, value: NoteEditorDropDownChoices.SwitchEditor,
child: rawEditor ? Text('Rich Editor') : Text('Raw Editor'), child: rawEditor ? const Text('Rich Editor') : const Text('Raw Editor'),
), ),
], ],
), ),

View File

@ -49,7 +49,7 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('TIMELINE'), title: const Text('TIMELINE'),
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(
icon: Icon(Icons.delete), icon: Icon(Icons.delete),
@ -106,14 +106,14 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: Text('Cancel'), child: const Text('Cancel'),
), ),
FlatButton( FlatButton(
onPressed: () { onPressed: () {
Navigator.pop(context); // Alert box Navigator.pop(context); // Alert box
_deleteNote(context); _deleteNote(context);
}, },
child: Text('Delete'), child: const Text('Delete'),
), ),
], ],
); );
@ -142,7 +142,7 @@ class NoteViewer extends StatelessWidget {
data: note.body, data: note.body,
styleSheet: MarkdownStyleSheet.fromTheme(theme), styleSheet: MarkdownStyleSheet.fromTheme(theme),
), ),
SizedBox(height: 64.0), const SizedBox(height: 64.0),
// _buildFooter(context), // _buildFooter(context),
], ],
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -42,7 +42,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
var row = Row( var row = Row(
children: <Widget>[ children: <Widget>[
OnBoardingBottomButton( OnBoardingBottomButton(
key: ValueKey("Skip"), key: const ValueKey("Skip"),
text: "Skip", text: "Skip",
onPressed: _finish, onPressed: _finish,
), ),
@ -61,7 +61,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
), ),
), ),
OnBoardingBottomButton( OnBoardingBottomButton(
key: ValueKey("Next"), key: const ValueKey("Next"),
text: "Next", text: "Next",
onPressed: _nextPage, onPressed: _nextPage,
), ),
@ -81,7 +81,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
width: double.infinity, width: double.infinity,
height: _bottomBarHeight, height: _bottomBarHeight,
child: RaisedButton( child: RaisedButton(
key: ValueKey("GetStarted"), key: const ValueKey("GetStarted"),
child: Text( child: Text(
"Get Started", "Get Started",
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -98,7 +98,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: pageView, child: pageView,
padding: EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
), ),
bottomNavigationBar: AnimatedSwitcher( bottomNavigationBar: AnimatedSwitcher(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
@ -161,7 +161,7 @@ class OnBoardingPage1 extends StatelessWidget {
height: 200, height: 200,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
Text( Text(
"GitJournal", "GitJournal",
style: headerTextStyle, style: headerTextStyle,
@ -173,7 +173,7 @@ class OnBoardingPage1 extends StatelessWidget {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Center(child: header), Center(child: header),
SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"A Journaling App focused on\nOpenness and Data Privacy", "A Journaling App focused on\nOpenness and Data Privacy",
style: textTheme.headline, style: textTheme.headline,
@ -201,7 +201,7 @@ class OnBoardingPage2 extends StatelessWidget {
//height: 200, //height: 200,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
], ],
); );
@ -209,7 +209,7 @@ class OnBoardingPage2 extends StatelessWidget {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Center(child: header), Center(child: header),
SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"Your Journal Entries are stored in a\nstandard Markdown + YAML\nHeader format", "Your Journal Entries are stored in a\nstandard Markdown + YAML\nHeader format",
style: textTheme.headline, style: textTheme.headline,
@ -237,7 +237,7 @@ class OnBoardingPage3 extends StatelessWidget {
//height: 200, //height: 200,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
], ],
); );
@ -245,7 +245,7 @@ class OnBoardingPage3 extends StatelessWidget {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Center(child: header), Center(child: header),
SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"Sync your Local Git Repo\nwith any provider", "Sync your Local Git Repo\nwith any provider",
style: textTheme.headline, style: textTheme.headline,

View File

@ -9,7 +9,7 @@ class SettingsScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Settings'), title: const Text('Settings'),
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back), icon: Icon(Icons.arrow_back),
onPressed: () { onPressed: () {
@ -124,7 +124,7 @@ class SettingsListState extends State<SettingsList> {
}, },
), ),
ListTile( ListTile(
title: Text("Font Size"), title: const Text("Font Size"),
subtitle: Text(settings.noteFontSize.toPublicString()), subtitle: Text(settings.noteFontSize.toPublicString()),
onTap: () async { onTap: () async {
var fontSize = await showDialog<NoteFontSize>( var fontSize = await showDialog<NoteFontSize>(
@ -142,7 +142,7 @@ class SettingsListState extends State<SettingsList> {
SettingsHeader("Git Author Settings"), SettingsHeader("Git Author Settings"),
ListTile(title: gitAuthorForm), ListTile(title: gitAuthorForm),
ListTile(title: gitAuthorEmailForm), ListTile(title: gitAuthorEmailForm),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
SettingsHeader("Storage"), SettingsHeader("Storage"),
ListPreference( ListPreference(
title: "File Name", title: "File Name",
@ -156,7 +156,7 @@ class SettingsListState extends State<SettingsList> {
setState(() {}); setState(() {});
}, },
), ),
SizedBox(height: 16.0), const SizedBox(height: 16.0),
SettingsHeader("Analytics"), SettingsHeader("Analytics"),
BoolPreference( BoolPreference(
title: "Collect Anonymous Usage Statistics", title: "Collect Anonymous Usage Statistics",
@ -188,7 +188,7 @@ class SettingsHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.only(left: 16.0, bottom: 0.0, top: 20.0), padding: const EdgeInsets.only(left: 16.0, bottom: 0.0, top: 20.0),
child: Text( child: Text(
text, text,
style: TextStyle( style: TextStyle(
@ -256,10 +256,10 @@ class FontSizeSettingsDialog extends StatelessWidget {
children: sizes, children: sizes,
), ),
), ),
contentPadding: EdgeInsets.all(0.0), contentPadding: const EdgeInsets.all(0.0),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: Text('CANCEL'), child: const Text('CANCEL'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -326,10 +326,10 @@ class ListPreference extends StatelessWidget {
children: children, children: children,
), ),
), ),
contentPadding: EdgeInsets.all(0.0), contentPadding: const EdgeInsets.all(0.0),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: Text('CANCEL'), child: const Text('CANCEL'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View File

@ -3,15 +3,15 @@ import 'package:flutter/material.dart';
class Themes { class Themes {
static final light = ThemeData( static final light = ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
primaryColor: Color(0xFF66bb6a), primaryColor: const Color(0xFF66bb6a),
primaryColorLight: Color(0xFF98ee99), primaryColorLight: const Color(0xFF98ee99),
primaryColorDark: Color(0xFF338a3e), primaryColorDark: const Color(0xFF338a3e),
accentColor: Color(0xff6d4c41), accentColor: const Color(0xff6d4c41),
); );
static final dark = ThemeData( static final dark = ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
primaryColor: Color(0xff212121), primaryColor: const Color(0xff212121),
accentColor: Color(0xff689f38), accentColor: const Color(0xff689f38),
); );
} }

View File

@ -50,7 +50,7 @@ class AppDrawer extends StatelessWidget {
child: DecoratedBox( child: DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage('assets/icon/icon.png'), image: const AssetImage('assets/icon/icon.png'),
), ),
), ),
), ),

View File

@ -19,7 +19,7 @@ class IconDismissable extends Dismissible {
color: backgroundColor, color: backgroundColor,
alignment: AlignmentDirectional.centerStart, alignment: AlignmentDirectional.centerStart,
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(16.0, 0.0, 0.0, 0.0), padding: const EdgeInsets.fromLTRB(16.0, 0.0, 0.0, 0.0),
child: Icon( child: Icon(
Icons.delete, Icons.delete,
color: Colors.white, color: Colors.white,
@ -30,7 +30,7 @@ class IconDismissable extends Dismissible {
color: backgroundColor, color: backgroundColor,
alignment: AlignmentDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0), padding: const EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
child: Icon( child: Icon(
Icons.delete, Icons.delete,
color: Colors.white, color: Colors.white,

View File

@ -86,13 +86,13 @@ class JournalList extends StatelessWidget {
var children = <Widget>[]; var children = <Widget>[];
if (time.isNotEmpty) { if (time.isNotEmpty) {
children.addAll(<Widget>[ children.addAll(<Widget>[
SizedBox(height: 4.0), const SizedBox(height: 4.0),
Text(time, style: textTheme.body1), Text(time, style: textTheme.body1),
]); ]);
} }
children.addAll(<Widget>[ children.addAll(<Widget>[
SizedBox(height: 4.0), const SizedBox(height: 4.0),
Text( Text(
body, body,
maxLines: 3, maxLines: 3,
@ -115,7 +115,7 @@ class JournalList extends StatelessWidget {
); );
return Padding( return Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0), padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: tile, child: tile,
); );
} }

View File

@ -30,7 +30,7 @@ class NoteHeader extends StatelessWidget {
var w = Row( var w = Row(
children: <Widget>[ children: <Widget>[
bigNum, bigNum,
SizedBox(width: 8.0), const SizedBox(width: 8.0),
Column( Column(
children: <Widget>[ children: <Widget>[
dateText, dateText,
@ -43,7 +43,7 @@ class NoteHeader extends StatelessWidget {
); );
return Padding( return Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 18.0), padding: const EdgeInsets.only(top: 8.0, bottom: 18.0),
child: w, child: w,
); );
} }