mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
AppDrawer: Minor refactor
This commit is contained in:
@ -59,9 +59,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (setupGitButton != null) ...[setupGitButton, divider],
|
if (setupGitButton != null) ...[setupGitButton, divider],
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.note, color: textStyle.color),
|
context,
|
||||||
title: Text('Notes', style: textStyle),
|
icon: Icons.note,
|
||||||
|
title: "Notes",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
var m = ModalRoute.of(context);
|
var m = ModalRoute.of(context);
|
||||||
if (m.settings.name == "/") {
|
if (m.settings.name == "/") {
|
||||||
@ -72,9 +73,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.folder, color: textStyle.color),
|
context,
|
||||||
title: Text('Folders', style: textStyle),
|
icon: Icons.folder,
|
||||||
|
title: "Folders",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
var m = ModalRoute.of(context);
|
var m = ModalRoute.of(context);
|
||||||
if (m.settings.name == "/folders") {
|
if (m.settings.name == "/folders") {
|
||||||
@ -85,9 +87,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
divider,
|
divider,
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.share, color: textStyle.color),
|
context,
|
||||||
title: Text('Share App', style: textStyle),
|
icon: Icons.share,
|
||||||
|
title: 'Share App',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Share.share('Checkout GitJournal https://gitjournal.io/');
|
Share.share('Checkout GitJournal https://gitjournal.io/');
|
||||||
@ -97,9 +100,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.feedback, color: textStyle.color),
|
context,
|
||||||
title: Text('Rate Us', style: textStyle),
|
icon: Icons.feedback,
|
||||||
|
title: 'Rate Us',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
LaunchReview.launch(
|
LaunchReview.launch(
|
||||||
androidAppId: "io.gitjournal.gitjournal",
|
androidAppId: "io.gitjournal.gitjournal",
|
||||||
@ -112,9 +116,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.rate_review, color: textStyle.color),
|
context,
|
||||||
title: Text('Feedback', style: textStyle),
|
icon: Icons.rate_review,
|
||||||
|
title: 'Feedback',
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var versionText = await getVersionString();
|
var versionText = await getVersionString();
|
||||||
|
|
||||||
@ -137,9 +142,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.bug_report, color: textStyle.color),
|
context,
|
||||||
title: Text('Bug Report', style: textStyle),
|
icon: Icons.bug_report,
|
||||||
|
title: 'Bug Report',
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var platform = Platform.operatingSystem;
|
var platform = Platform.operatingSystem;
|
||||||
var versionText = await getVersionString();
|
var versionText = await getVersionString();
|
||||||
@ -162,9 +168,10 @@ class AppDrawer extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
_buildDrawerTile(
|
||||||
leading: Icon(Icons.settings, color: textStyle.color),
|
context,
|
||||||
title: Text('Settings', style: textStyle),
|
icon: Icons.settings,
|
||||||
|
title: 'Settings',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pushNamed(context, "/settings");
|
Navigator.pushNamed(context, "/settings");
|
||||||
@ -178,4 +185,19 @@ class AppDrawer extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListTile _buildDrawerTile(
|
||||||
|
BuildContext context, {
|
||||||
|
@required IconData icon,
|
||||||
|
@required String title,
|
||||||
|
@required Function onTap,
|
||||||
|
}) {
|
||||||
|
var textStyle = Theme.of(context).textTheme.body2;
|
||||||
|
|
||||||
|
return ListTile(
|
||||||
|
leading: Icon(icon, color: textStyle.color),
|
||||||
|
title: Text(title, style: textStyle),
|
||||||
|
onTap: onTap,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user