mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: primitive app selector screen.
This commit is contained in:
parent
fa8fa5c820
commit
0350dacb3b
@ -3,6 +3,7 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
<application
|
<application
|
||||||
android:label="revanced_manager_flutter"
|
android:label="revanced_manager_flutter"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
44
lib/ui/screens/app_selector_screen.dart
Normal file
44
lib/ui/screens/app_selector_screen.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:device_apps/device_apps.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:revanced_manager_flutter/ui/widgets/installed_app_item.dart';
|
||||||
|
|
||||||
|
class AppSelectorScreen extends StatefulWidget {
|
||||||
|
const AppSelectorScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AppSelectorScreen> createState() => _AppSelectorScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AppSelectorScreenState extends State<AppSelectorScreen> {
|
||||||
|
List<Application> apps = [];
|
||||||
|
|
||||||
|
void getApps() async {
|
||||||
|
apps = await DeviceApps.getInstalledApplications();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
getApps();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: apps.isEmpty
|
||||||
|
? const Center(child: CircularProgressIndicator())
|
||||||
|
: ListView.builder(
|
||||||
|
itemCount: apps.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return InstalledAppItem(
|
||||||
|
name: apps[index].appName,
|
||||||
|
pkgName: apps[index].packageName,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:revanced_manager_flutter/ui/screens/app_selector_screen.dart';
|
||||||
import 'package:revanced_manager_flutter/ui/widgets/app_selector_card.dart';
|
import 'package:revanced_manager_flutter/ui/widgets/app_selector_card.dart';
|
||||||
import 'package:revanced_manager_flutter/ui/widgets/patch_selector_card.dart';
|
import 'package:revanced_manager_flutter/ui/widgets/patch_selector_card.dart';
|
||||||
|
|
||||||
@ -33,18 +34,10 @@ class PatcherScreen extends StatelessWidget {
|
|||||||
const SizedBox(height: 23),
|
const SizedBox(height: 23),
|
||||||
AppSelectorCard(
|
AppSelectorCard(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
//show snackbar
|
Navigator.push(
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
context,
|
||||||
SnackBar(
|
MaterialPageRoute(
|
||||||
content: Text(
|
builder: (context) => AppSelectorScreen()));
|
||||||
"Select application",
|
|
||||||
style: GoogleFonts.inter(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
42
lib/ui/widgets/installed_app_item.dart
Normal file
42
lib/ui/widgets/installed_app_item.dart
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class InstalledAppItem extends StatelessWidget {
|
||||||
|
final String name;
|
||||||
|
final String pkgName;
|
||||||
|
|
||||||
|
const InstalledAppItem({
|
||||||
|
Key? key,
|
||||||
|
required this.name,
|
||||||
|
required this.pkgName,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: const Color(0xff1B222B),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(name),
|
||||||
|
Text(pkgName),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged: (val) {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.5"
|
version: "1.0.5"
|
||||||
|
device_apps:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: device_apps
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -40,6 +40,7 @@ dependencies:
|
|||||||
github: ^9.4.0
|
github: ^9.4.0
|
||||||
path_provider: ^2.0.11
|
path_provider: ^2.0.11
|
||||||
dio: ^4.0.6
|
dio: ^4.0.6
|
||||||
|
device_apps: ^2.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user