Compare commits

...

12 Commits

Author SHA1 Message Date
Imran Remtulla
2272f8b4e6 Merge pull request #15 from ImranR98/ui-improvements
UI improvements
2022-09-17 18:42:05 -04:00
Imran Remtulla
9514062a3a Updated version 2022-09-17 18:40:01 -04:00
Imran Remtulla
da57018b90 Added "not installed" button 2022-09-17 18:39:11 -04:00
Imran Remtulla
87e31c37aa 'Already Installed' button also takes 'Already Updated' 2022-09-17 18:11:00 -04:00
Imran Remtulla
cb4dfff1b9 Added nav animation 2022-09-17 18:06:05 -04:00
Imran Remtulla
911b06bfb6 Slight tweak to import/export buttons 2022-09-17 17:54:50 -04:00
Imran Remtulla
53513bfdd1 Added sections to settings page 2022-09-17 17:19:58 -04:00
Imran Remtulla
681092d895 Colour, alignment fixes 2022-09-17 17:00:08 -04:00
Imran Remtulla
0f6b6253de Reduced haptic feedback (consequential actions only) 2022-09-17 16:48:42 -04:00
Imran Remtulla
c724b276ab Added strechy appbars to all pages 2022-09-17 16:15:30 -04:00
Imran Remtulla
35369273bd Changed source order, started adding strechy titlebars 2022-09-17 14:39:38 -04:00
Imran Remtulla
0b1863a227 Update README.md 2022-09-17 02:34:14 -04:00
14 changed files with 771 additions and 583 deletions

View File

@@ -10,6 +10,7 @@ Currently supported App sources:
- [GitHub](https://github.com/) - [GitHub](https://github.com/)
- [GitLab](https://gitlab.com/) - [GitLab](https://gitlab.com/)
- [F-Droid](https://f-droid.org/) - [F-Droid](https://f-droid.org/)
- [IzzyOnDroid](https://android.izzysoft.de/)
- [Mullvad](https://mullvad.net/en/) - [Mullvad](https://mullvad.net/en/)
- [Signal](https://signal.org/) - [Signal](https://signal.org/)

View File

@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class CustomAppBar extends StatefulWidget {
const CustomAppBar({super.key, required this.title});
final String title;
@override
State<CustomAppBar> createState() => _CustomAppBarState();
}
class _CustomAppBarState extends State<CustomAppBar> {
@override
Widget build(BuildContext context) {
return SliverAppBar(
pinned: true,
automaticallyImplyLeading: false,
expandedHeight: 100,
flexibleSpace: FlexibleSpaceBar(
titlePadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
title: Text(
widget.title,
style:
TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color),
),
),
);
}
}

View File

@@ -59,14 +59,13 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(null); Navigator.of(context).pop(null);
}, },
child: const Text('Cancel')), child: const Text('Cancel')),
TextButton( TextButton(
onPressed: () { onPressed: () {
if (_formKey.currentState?.validate() == true) { if (_formKey.currentState?.validate() == true) {
HapticFeedback.heavyImpact(); HapticFeedback.selectionClick();
Navigator.of(context).pop(formInputs Navigator.of(context).pop(formInputs
.map((e) => (e[0] as TextEditingController).value.text) .map((e) => (e[0] as TextEditingController).value.text)
.toList()); .toList());

View File

@@ -12,7 +12,7 @@ import 'package:dynamic_color/dynamic_color.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
const String currentReleaseTag = const String currentReleaseTag =
'v0.2.1-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES 'v0.2.2-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
@pragma('vm:entry-point') @pragma('vm:entry-point')
void bgTaskCallback() { void bgTaskCallback() {

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/pages/app.dart'; import 'package:obtainium/pages/app.dart';
import 'package:obtainium/providers/apps_provider.dart'; import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart'; import 'package:obtainium/providers/settings_provider.dart';
@@ -22,7 +23,11 @@ class _AddAppPageState extends State<AddAppPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SourceProvider sourceProvider = SourceProvider(); SourceProvider sourceProvider = SourceProvider();
return Center( return CustomScrollView(slivers: <Widget>[
const CustomAppBar(title: 'Add App'),
SliverFillRemaining(
hasScrollBody: false,
child: Center(
child: Form( child: Form(
key: _formKey, key: _formKey,
child: Column( child: Column(
@@ -55,19 +60,21 @@ class _AddAppPageState extends State<AddAppPage> {
onPressed: gettingAppInfo onPressed: gettingAppInfo
? null ? null
: () { : () {
HapticFeedback.mediumImpact(); HapticFeedback.selectionClick();
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
setState(() { setState(() {
gettingAppInfo = true; gettingAppInfo = true;
}); });
sourceProvider sourceProvider
.getApp(urlInputController.value.text) .getApp(
urlInputController.value.text)
.then((app) { .then((app) {
var appsProvider = var appsProvider =
context.read<AppsProvider>(); context.read<AppsProvider>();
var settingsProvider = var settingsProvider =
context.read<SettingsProvider>(); context.read<SettingsProvider>();
if (appsProvider.apps.containsKey(app.id)) { if (appsProvider.apps
.containsKey(app.id)) {
throw 'App already added'; throw 'App already added';
} }
settingsProvider settingsProvider
@@ -79,12 +86,15 @@ class _AddAppPageState extends State<AddAppPage> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
AppPage(appId: app.id))); AppPage(
appId: app.id)));
}); });
}); });
}).catchError((e) { }).catchError((e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context)
SnackBar(content: Text(e.toString())), .showSnackBar(
SnackBar(
content: Text(e.toString())),
); );
}).whenComplete(() { }).whenComplete(() {
setState(() { setState(() {
@@ -99,7 +109,9 @@ class _AddAppPageState extends State<AddAppPage> {
], ],
), ),
), ),
Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text( const Text(
'Supported Sources:', 'Supported Sources:',
// style: TextStyle(fontWeight: FontWeight.bold), // style: TextStyle(fontWeight: FontWeight.bold),
@@ -129,6 +141,7 @@ class _AddAppPageState extends State<AddAppPage> {
Container(), Container(),
], ],
)), )),
); ))
]);
} }
} }

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/providers/apps_provider.dart'; import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart'; import 'package:obtainium/providers/settings_provider.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@@ -25,10 +26,11 @@ class _AppPageState extends State<AppPage> {
appsProvider.getUpdate(app!.app.id); appsProvider.getUpdate(app!.app.id);
} }
return Scaffold( return Scaffold(
appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.surface,
title: Text('${app?.app.author}/${app?.app.name}'), body: CustomScrollView(slivers: <Widget>[
), CustomAppBar(title: '${app?.app.name}'),
body: settingsProvider.showAppWebpage SliverFillRemaining(
child: settingsProvider.showAppWebpage
? WebView( ? WebView(
initialUrl: app?.app.url, initialUrl: app?.app.url,
javascriptMode: JavascriptMode.unrestricted, javascriptMode: JavascriptMode.unrestricted,
@@ -80,6 +82,8 @@ class _AppPageState extends State<AppPage> {
), ),
], ],
), ),
),
]),
bottomSheet: Padding( bottomSheet: Padding(
padding: EdgeInsets.fromLTRB( padding: EdgeInsets.fromLTRB(
0, 0, 0, MediaQuery.of(context).padding.bottom), 0, 0, 0, MediaQuery.of(context).padding.bottom),
@@ -91,15 +95,15 @@ class _AppPageState extends State<AppPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
if (app?.app.installedVersion == null) if (app?.app.installedVersion != app?.app.latestVersion)
IconButton( IconButton(
onPressed: () { onPressed: () {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext ctx) { builder: (BuildContext ctx) {
return AlertDialog( return AlertDialog(
title: const Text( title: Text(
'App Already Installed?'), 'App Already ${app?.app.installedVersion == null ? 'Installed' : 'Updated'}?'),
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
@@ -108,6 +112,7 @@ class _AppPageState extends State<AppPage> {
child: const Text('No')), child: const Text('No')),
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.selectionClick();
var updatedApp = app?.app; var updatedApp = app?.app;
if (updatedApp != null) { if (updatedApp != null) {
updatedApp.installedVersion = updatedApp.installedVersion =
@@ -124,8 +129,41 @@ class _AppPageState extends State<AppPage> {
}); });
}, },
tooltip: 'Mark as Installed', tooltip: 'Mark as Installed',
icon: const Icon(Icons.done)), icon: const Icon(Icons.done))
if (app?.app.installedVersion == null) else
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (BuildContext ctx) {
return AlertDialog(
title: const Text('App Not Installed?'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('No')),
TextButton(
onPressed: () {
HapticFeedback.selectionClick();
var updatedApp = app?.app;
if (updatedApp != null) {
updatedApp.installedVersion =
null;
appsProvider
.saveApp(updatedApp);
}
Navigator.of(context).pop();
},
child: const Text(
'Yes, Mark as Not Installed'))
],
);
});
},
tooltip: 'Mark as Not Installed',
icon: const Icon(Icons.no_cell_outlined)),
const SizedBox(width: 16.0), const SizedBox(width: 16.0),
Expanded( Expanded(
child: ElevatedButton( child: ElevatedButton(
@@ -154,7 +192,6 @@ class _AppPageState extends State<AppPage> {
onPressed: app?.downloadProgress != null onPressed: app?.downloadProgress != null
? null ? null
: () { : () {
HapticFeedback.lightImpact();
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext ctx) { builder: (BuildContext ctx) {
@@ -165,7 +202,8 @@ class _AppPageState extends State<AppPage> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.heavyImpact(); HapticFeedback
.selectionClick();
appsProvider appsProvider
.removeApp(app!.app.id) .removeApp(app!.app.id)
.then((_) { .then((_) {
@@ -178,7 +216,6 @@ class _AppPageState extends State<AppPage> {
child: const Text('Remove')), child: const Text('Remove')),
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text('Cancel')) child: const Text('Cancel'))

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/pages/app.dart'; import 'package:obtainium/pages/app.dart';
import 'package:obtainium/providers/apps_provider.dart'; import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart'; import 'package:obtainium/providers/settings_provider.dart';
@@ -35,6 +36,7 @@ class _AppsPageState extends State<AppsPage> {
} }
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
floatingActionButton: existingUpdateAppIds.isEmpty floatingActionButton: existingUpdateAppIds.isEmpty
? null ? null
: ElevatedButton.icon( : ElevatedButton.icon(
@@ -47,34 +49,39 @@ class _AppsPageState extends State<AppsPage> {
existingUpdateAppIds, context); existingUpdateAppIds, context);
}); });
}, },
icon: const Icon(Icons.update), icon: const Icon(Icons.install_mobile_outlined),
label: const Text('Update All')), label: const Text('Install All')),
body: Center( body: RefreshIndicator(
child: appsProvider.loadingApps
? const CircularProgressIndicator()
: appsProvider.apps.isEmpty
? Text(
'No Apps',
style: Theme.of(context).textTheme.headlineMedium,
)
: RefreshIndicator(
onRefresh: () { onRefresh: () {
HapticFeedback.lightImpact(); HapticFeedback.lightImpact();
return appsProvider.checkUpdates(); return appsProvider.checkUpdates();
}, },
child: ListView( child: CustomScrollView(slivers: <Widget>[
children: sortedApps const CustomAppBar(title: 'Apps'),
.map( if (appsProvider.loadingApps || appsProvider.apps.isEmpty)
(e) => ListTile( SliverFillRemaining(
title: Text('${e.app.author}/${e.app.name}'), child: Center(
subtitle: Text( child: appsProvider.loadingApps
e.app.installedVersion ?? 'Not Installed'), ? const CircularProgressIndicator()
trailing: e.downloadProgress != null : Text(
'No Apps',
style:
Theme.of(context).textTheme.headlineMedium,
))),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return ListTile(
title: Text(
'${sortedApps[index].app.author}/${sortedApps[index].app.name}'),
subtitle: Text(sortedApps[index].app.installedVersion ??
'Not Installed'),
trailing: sortedApps[index].downloadProgress != null
? Text( ? Text(
'Downloading - ${e.downloadProgress?.toInt()}%') 'Downloading - ${sortedApps[index].downloadProgress?.toInt()}%')
: (e.app.installedVersion != null && : (sortedApps[index].app.installedVersion != null &&
e.app.installedVersion != sortedApps[index].app.installedVersion !=
e.app.latestVersion sortedApps[index].app.latestVersion
? const Text('Update Available') ? const Text('Update Available')
: null), : null),
onTap: () { onTap: () {
@@ -82,14 +89,11 @@ class _AppsPageState extends State<AppsPage> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
AppPage(appId: e.app.id)), AppPage(appId: sortedApps[index].app.id)),
); );
}, },
), );
) }, childCount: sortedApps.length))
.toList(), ])));
),
),
));
} }
} }

View File

@@ -1,3 +1,4 @@
import 'package:animations/animations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/pages/add_app.dart'; import 'package:obtainium/pages/add_app.dart';
@@ -12,33 +13,56 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState(); State<HomePage> createState() => _HomePageState();
} }
class NavigationPageItem {
late String title;
late IconData icon;
late Widget widget;
NavigationPageItem(this.title, this.icon, this.widget);
}
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
List<int> selectedIndexHistory = []; List<int> selectedIndexHistory = [];
List<Widget> pages = [
const AppsPage(), List<NavigationPageItem> pages = [
const AddAppPage(), NavigationPageItem('Apps', Icons.apps, const AppsPage()),
const ImportExportPage(), NavigationPageItem('Add App', Icons.add, const AddAppPage()),
const SettingsPage() NavigationPageItem(
'Import/Export', Icons.import_export, const ImportExportPage()),
NavigationPageItem('Settings', Icons.settings, const SettingsPage())
]; ];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
child: Scaffold( child: Scaffold(
appBar: AppBar(title: const Text('Obtainium')), backgroundColor: Theme.of(context).colorScheme.surface,
body: pages.elementAt( body: PageTransitionSwitcher(
selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last), transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: SharedAxisTransitionType.horizontal,
child: child,
);
},
child: pages
.elementAt(selectedIndexHistory.isEmpty
? 0
: selectedIndexHistory.last)
.widget,
),
bottomNavigationBar: NavigationBar( bottomNavigationBar: NavigationBar(
destinations: const [ destinations: pages
NavigationDestination(icon: Icon(Icons.apps), label: 'Apps'), .map((e) =>
NavigationDestination(icon: Icon(Icons.add), label: 'Add App'), NavigationDestination(icon: Icon(e.icon), label: e.title))
NavigationDestination( .toList(),
icon: Icon(Icons.import_export), label: 'Import/Export'),
NavigationDestination(
icon: Icon(Icons.settings), label: 'Settings'),
],
onDestinationSelected: (int index) { onDestinationSelected: (int index) {
HapticFeedback.lightImpact(); HapticFeedback.selectionClick();
setState(() { setState(() {
if (index == 0) { if (index == 0) {
selectedIndexHistory.clear(); selectedIndexHistory.clear();

View File

@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/components/generated_form_modal.dart'; import 'package:obtainium/components/generated_form_modal.dart';
import 'package:obtainium/providers/apps_provider.dart'; import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart'; import 'package:obtainium/providers/settings_provider.dart';
@@ -25,6 +26,16 @@ class _ImportExportPageState extends State<ImportExportPage> {
SourceProvider sourceProvider = SourceProvider(); SourceProvider sourceProvider = SourceProvider();
var settingsProvider = context.read<SettingsProvider>(); var settingsProvider = context.read<SettingsProvider>();
var appsProvider = context.read<AppsProvider>(); var appsProvider = context.read<AppsProvider>();
var outlineButtonStyle = ButtonStyle(
shape: MaterialStateProperty.all(
StadiumBorder(
side: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.primary,
),
),
),
);
Future<List<List<String>>> addApps(List<String> urls) async { Future<List<List<String>>> addApps(List<String> urls) async {
await settingsProvider.getInstallPermission(); await settingsProvider.getInstallPermission();
@@ -43,45 +54,67 @@ class _ImportExportPageState extends State<ImportExportPage> {
return errors; return errors;
} }
return Padding( return CustomScrollView(slivers: <Widget>[
const CustomAppBar(title: 'Import/Export'),
SliverFillRemaining(
hasScrollBody: false,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
ElevatedButton( Row(
onPressed: appsProvider.apps.isEmpty || importInProgress children: [
Expanded(
child: TextButton(
style: outlineButtonStyle,
onPressed: appsProvider.apps.isEmpty ||
importInProgress
? null ? null
: () { : () {
HapticFeedback.lightImpact(); HapticFeedback.selectionClick();
appsProvider.exportApps().then((String path) { appsProvider
ScaffoldMessenger.of(context).showSnackBar( .exportApps()
SnackBar(content: Text('Exported to $path')), .then((String path) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
content:
Text('Exported to $path')),
); );
}); });
}, },
child: const Text('Obtainium Export')), child: const Text('Obtainium Export'))),
const SizedBox( const SizedBox(
height: 8, width: 16,
), ),
ElevatedButton( Expanded(
child: TextButton(
style: outlineButtonStyle,
onPressed: importInProgress onPressed: importInProgress
? null ? null
: () { : () {
HapticFeedback.lightImpact(); HapticFeedback.selectionClick();
FilePicker.platform.pickFiles().then((result) { FilePicker.platform
.pickFiles()
.then((result) {
setState(() { setState(() {
importInProgress = true; importInProgress = true;
}); });
if (result != null) { if (result != null) {
String data = File(result.files.single.path!) String data =
File(result.files.single.path!)
.readAsStringSync(); .readAsStringSync();
try { try {
jsonDecode(data); jsonDecode(data);
} catch (e) { } catch (e) {
throw 'Invalid input'; throw 'Invalid input';
} }
appsProvider.importApps(data).then((value) { appsProvider
ScaffoldMessenger.of(context).showSnackBar( .importApps(data)
.then((value) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
'$value App${value == 1 ? '' : 's'} Imported')), '$value App${value == 1 ? '' : 's'} Imported')),
@@ -91,7 +124,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
// User canceled the picker // User canceled the picker
} }
}).catchError((e) { }).catchError((e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(content: Text(e.toString())), SnackBar(content: Text(e.toString())),
); );
}).whenComplete(() { }).whenComplete(() {
@@ -100,7 +134,9 @@ class _ImportExportPageState extends State<ImportExportPage> {
}); });
}); });
}, },
child: const Text('Obtainium Import')), child: const Text('Obtainium Import')))
],
),
if (importInProgress) if (importInProgress)
Column( Column(
children: const [ children: const [
@@ -127,7 +163,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
return GeneratedFormModal( return GeneratedFormModal(
title: 'Import from URL List', title: 'Import from URL List',
items: [ items: [
GeneratedFormItem('App URL List', true, 7) GeneratedFormItem(
'App URL List', true, 7)
], ],
); );
}).then((values) { }).then((values) {
@@ -138,10 +175,11 @@ class _ImportExportPageState extends State<ImportExportPage> {
}); });
addApps(urls).then((errors) { addApps(urls).then((errors) {
if (errors.isEmpty) { if (errors.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar( SnackBar(
content: content: Text(
Text('Imported ${urls.length} Apps')), 'Imported ${urls.length} Apps')),
); );
} else { } else {
showDialog( showDialog(
@@ -164,7 +202,9 @@ class _ImportExportPageState extends State<ImportExportPage> {
} }
}); });
}, },
child: const Text('Import from URL List')), child: const Text(
'Import from URL List',
)),
...sourceProvider.massSources ...sourceProvider.massSources
.map((source) => Column( .map((source) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -178,7 +218,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
context: context, context: context,
builder: (BuildContext ctx) { builder: (BuildContext ctx) {
return GeneratedFormModal( return GeneratedFormModal(
title: 'Import ${source.name}', title:
'Import ${source.name}',
items: source.requiredArgs items: source.requiredArgs
.map((e) => .map((e) =>
GeneratedFormItem( GeneratedFormItem(
@@ -186,13 +227,16 @@ class _ImportExportPageState extends State<ImportExportPage> {
.toList()); .toList());
}).then((values) { }).then((values) {
if (values != null) { if (values != null) {
source.getUrls(values).then((urls) { source
.getUrls(values)
.then((urls) {
setState(() { setState(() {
importInProgress = true; importInProgress = true;
}); });
addApps(urls).then((errors) { addApps(urls).then((errors) {
if (errors.isEmpty) { if (errors.isEmpty) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(
context)
.showSnackBar( .showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
@@ -201,8 +245,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
} else { } else {
showDialog( showDialog(
context: context, context: context,
builder: builder: (BuildContext
(BuildContext ctx) { ctx) {
return ImportErrorDialog( return ImportErrorDialog(
urlsLength: urlsLength:
urls.length, urls.length,
@@ -218,7 +262,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar( .showSnackBar(
SnackBar( SnackBar(
content: Text(e.toString())), content:
Text(e.toString())),
); );
}); });
} }
@@ -228,7 +273,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
])) ]))
.toList() .toList()
], ],
)); )))
]);
} }
} }
@@ -278,7 +324,6 @@ class _ImportErrorDialogState extends State<ImportErrorDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(null); Navigator.of(context).pop(null);
}, },
child: const Text('Okay')) child: const Text('Okay'))

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/providers/settings_provider.dart'; import 'package:obtainium/providers/settings_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@@ -18,14 +19,25 @@ class _SettingsPageState extends State<SettingsPage> {
if (settingsProvider.prefs == null) { if (settingsProvider.prefs == null) {
settingsProvider.initializeSettings(); settingsProvider.initializeSettings();
} }
return Padding( return CustomScrollView(slivers: <Widget>[
const CustomAppBar(title: 'Add App'),
SliverFillRemaining(
hasScrollBody: true,
child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: settingsProvider.prefs == null child: settingsProvider.prefs == null
? Container() ? Container()
: Column( : Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(
'Appearance',
style: TextStyle(
color: Theme.of(context).colorScheme.primary),
),
DropdownButtonFormField( DropdownButtonFormField(
decoration: const InputDecoration(labelText: 'Theme'), decoration:
const InputDecoration(labelText: 'Theme'),
value: settingsProvider.theme, value: settingsProvider.theme,
items: const [ items: const [
DropdownMenuItem( DropdownMenuItem(
@@ -50,7 +62,8 @@ class _SettingsPageState extends State<SettingsPage> {
height: 16, height: 16,
), ),
DropdownButtonFormField( DropdownButtonFormField(
decoration: const InputDecoration(labelText: 'Colour'), decoration:
const InputDecoration(labelText: 'Colour'),
value: settingsProvider.colour, value: settingsProvider.colour,
items: const [ items: const [
DropdownMenuItem( DropdownMenuItem(
@@ -70,9 +83,88 @@ class _SettingsPageState extends State<SettingsPage> {
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: DropdownButtonFormField(
decoration: const InputDecoration(
labelText: 'App Sort By'),
value: settingsProvider.sortColumn,
items: const [
DropdownMenuItem(
value: SortColumnSettings.authorName,
child: Text('Author/Name'),
),
DropdownMenuItem(
value: SortColumnSettings.nameAuthor,
child: Text('Name/Author'),
),
DropdownMenuItem(
value: SortColumnSettings.added,
child: Text('As Added'),
)
],
onChanged: (value) {
if (value != null) {
settingsProvider.sortColumn = value;
}
})),
const SizedBox(
width: 16,
),
Expanded(
child: DropdownButtonFormField(
decoration: const InputDecoration(
labelText: 'App Sort Order'),
value: settingsProvider.sortOrder,
items: const [
DropdownMenuItem(
value: SortOrderSettings.ascending,
child: Text('Ascending'),
),
DropdownMenuItem(
value: SortOrderSettings.descending,
child: Text('Descending'),
),
],
onChanged: (value) {
if (value != null) {
settingsProvider.sortOrder = value;
}
})),
],
),
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Show Source Webpage in App View'),
Switch(
value: settingsProvider.showAppWebpage,
onChanged: (value) {
settingsProvider.showAppWebpage = value;
})
],
),
const Divider(
height: 16,
),
const SizedBox(
height: 16,
),
Text(
'More',
style: TextStyle(
color: Theme.of(context).colorScheme.primary),
),
DropdownButtonFormField( DropdownButtonFormField(
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: 'Background Update Checking Interval'), labelText:
'Background Update Checking Interval'),
value: settingsProvider.updateInterval, value: settingsProvider.updateInterval,
items: const [ items: const [
DropdownMenuItem( DropdownMenuItem(
@@ -109,68 +201,6 @@ class _SettingsPageState extends State<SettingsPage> {
settingsProvider.updateInterval = value; settingsProvider.updateInterval = value;
} }
}), }),
const SizedBox(
height: 16,
),
DropdownButtonFormField(
decoration:
const InputDecoration(labelText: 'App Sort By'),
value: settingsProvider.sortColumn,
items: const [
DropdownMenuItem(
value: SortColumnSettings.authorName,
child: Text('Author/Name'),
),
DropdownMenuItem(
value: SortColumnSettings.nameAuthor,
child: Text('Name/Author'),
),
DropdownMenuItem(
value: SortColumnSettings.added,
child: Text('As Added'),
)
],
onChanged: (value) {
if (value != null) {
settingsProvider.sortColumn = value;
}
}),
const SizedBox(
height: 16,
),
DropdownButtonFormField(
decoration:
const InputDecoration(labelText: 'App Sort Order'),
value: settingsProvider.sortOrder,
items: const [
DropdownMenuItem(
value: SortOrderSettings.ascending,
child: Text('Ascending'),
),
DropdownMenuItem(
value: SortOrderSettings.descending,
child: Text('Descending'),
),
],
onChanged: (value) {
if (value != null) {
settingsProvider.sortOrder = value;
}
}),
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Show Source Webpage in App View'),
Switch(
value: settingsProvider.showAppWebpage,
onChanged: (value) {
settingsProvider.showAppWebpage = value;
})
],
),
const Spacer(), const Spacer(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -184,7 +214,6 @@ class _SettingsPageState extends State<SettingsPage> {
}), }),
), ),
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
launchUrlString(settingsProvider.sourceUrl, launchUrlString(settingsProvider.sourceUrl,
mode: LaunchMode.externalApplication); mode: LaunchMode.externalApplication);
}, },
@@ -197,6 +226,7 @@ class _SettingsPageState extends State<SettingsPage> {
], ],
), ),
], ],
)); )))
]);
} }
} }

View File

@@ -339,13 +339,12 @@ class _APKPickerState extends State<APKPicker> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(null); Navigator.of(context).pop(null);
}, },
child: const Text('Cancel')), child: const Text('Cancel')),
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.heavyImpact(); HapticFeedback.selectionClick();
Navigator.of(context).pop(apkUrl); Navigator.of(context).pop(apkUrl);
}, },
child: const Text('Continue')) child: const Text('Continue'))
@@ -376,13 +375,12 @@ class _APKOriginWarningDialogState extends State<APKOriginWarningDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(null); Navigator.of(context).pop(null);
}, },
child: const Text('Cancel')), child: const Text('Cancel')),
TextButton( TextButton(
onPressed: () { onPressed: () {
HapticFeedback.heavyImpact(); HapticFeedback.selectionClick();
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
child: const Text('Continue')) child: const Text('Continue'))

View File

@@ -399,9 +399,9 @@ class SourceProvider {
GitHub(), GitHub(),
GitLab(), GitLab(),
FDroid(), FDroid(),
IzzyOnDroid(),
Mullvad(), Mullvad(),
Signal(), Signal()
IzzyOnDroid()
]; ];
List<MassAppSource> massSources = [GitHubStars()]; List<MassAppSource> massSources = [GitHubStars()];

View File

@@ -1,6 +1,13 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
animations:
dependency: "direct main"
description:
name: animations
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@@ -201,21 +208,21 @@ packages:
name: flutter_local_notifications name: flutter_local_notifications
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "9.9.1" version: "10.0.0"
flutter_local_notifications_linux: flutter_local_notifications_linux:
dependency: transitive dependency: transitive
description: description:
name: flutter_local_notifications_linux name: flutter_local_notifications_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.1" version: "1.0.0"
flutter_local_notifications_platform_interface: flutter_local_notifications_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: flutter_local_notifications_platform_interface name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0" version: "6.0.0"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:

View File

@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 0.2.1+12 # When changing this, update the tag in main() accordingly version: 0.2.2+13 # When changing this, update the tag in main() accordingly
environment: environment:
sdk: '>=2.19.0-79.0.dev <3.0.0' sdk: '>=2.19.0-79.0.dev <3.0.0'
@@ -38,7 +38,7 @@ dependencies:
cupertino_icons: ^1.0.5 cupertino_icons: ^1.0.5
path_provider: ^2.0.11 path_provider: ^2.0.11
flutter_fgbg: ^0.2.0 # Try removing reliance on this flutter_fgbg: ^0.2.0 # Try removing reliance on this
flutter_local_notifications: ^9.9.1 flutter_local_notifications: ^10.0.0
provider: ^6.0.3 provider: ^6.0.3
http: ^0.13.5 http: ^0.13.5
webview_flutter: ^3.0.4 webview_flutter: ^3.0.4
@@ -52,6 +52,7 @@ dependencies:
fluttertoast: ^8.0.9 fluttertoast: ^8.0.9
device_info_plus: ^4.1.2 device_info_plus: ^4.1.2
file_picker: ^5.1.0 file_picker: ^5.1.0
animations: ^2.0.4
dev_dependencies: dev_dependencies: