Skip to content

Commit

Permalink
ui: move Privacy Policy and EULA from settings screen to app drawer (#…
Browse files Browse the repository at this point in the history
…815)

Move Privacy Policy and EULA from settings screen to app drawer
  • Loading branch information
anhappdev authored Nov 28, 2023
1 parent e76556c commit dea1857
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
5 changes: 5 additions & 0 deletions flutter/lib/app_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ class BackendId {
apple,
];
}

class Url {
static const privacyPolicy = 'https://mlcommons.org/mobile_privacy';
static const eula = 'https://mlcommons.org/mobile_eula';
}
2 changes: 1 addition & 1 deletion flutter/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"settingsKeepLogsSubtitle": "Keep loadgen logs of future runs.\nThis option doesn't affect past logs.",
"settingsCooldown": "Cooldown",
"settingsCooldownSubtitle": "Pause <cooldownPause> minutes before running each benchmark to avoid thermal throttling.",
"settingsPrivacyPolicy": "Privacy policy",
"settingsPrivacyPolicy": "Privacy Policy",
"settingsEula": "End User License Agreement",
"settingsTaskConfigTitle": "Task configuration",
"settingsTaskConfigInternetResource": "downloadable",
Expand Down
20 changes: 14 additions & 6 deletions flutter/lib/ui/home/app_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'package:flutter/material.dart';

import 'package:url_launcher/url_launcher.dart';

import 'package:mlperfbench/app_constants.dart';
import 'package:mlperfbench/firebase/firebase_manager.dart';
import 'package:mlperfbench/localizations/app_localizations.dart';
import 'package:mlperfbench/ui/config/config_screen.dart';
Expand All @@ -16,12 +19,7 @@ class AppDrawer extends StatelessWidget {
final header = buildHeader(context);
final menuList = buildMenuList(context);
return Drawer(
// Add a ListView to the drawer. This ensures the user can scroll
// through the options in the drawer if there isn't enough vertical
// space to fit everything.
child: ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
child: Column(
children: [header] + menuList,
),
);
Expand Down Expand Up @@ -107,6 +105,16 @@ class AppDrawer extends StatelessWidget {
));
},
),
const Spacer(),
const Divider(),
ListTile(
title: Text(l10n.settingsPrivacyPolicy),
onTap: () => launchUrl(Uri.parse(Url.privacyPolicy)),
),
ListTile(
title: Text(l10n.settingsEula),
onTap: () => launchUrl(Uri.parse(Url.eula)),
),
];
}
}
14 changes: 0 additions & 14 deletions flutter/lib/ui/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/material.dart';

import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';

import 'package:mlperfbench/benchmark/run_mode.dart';
import 'package:mlperfbench/benchmark/state.dart';
Expand Down Expand Up @@ -171,19 +170,6 @@ class _SettingsScreen extends State<SettingsScreen> {
const Divider(),
crashlyticsSwitch,
const Divider(),
ListTile(
title: Text(l10n.settingsPrivacyPolicy),
trailing: const Icon(Icons.chevron_right),
onTap: () =>
launchUrl(Uri.parse('https://mlcommons.org/mobile_privacy')),
),
ListTile(
title: Text(l10n.settingsEula),
trailing: const Icon(Icons.chevron_right),
onTap: () =>
launchUrl(Uri.parse('https://mlcommons.org/mobile_eula')),
),
const Divider(),
ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 5),
Expand Down

0 comments on commit dea1857

Please sign in to comment.