mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 05:54:26 +02:00
refactor: split into smaller widgets.
This commit is contained in:
parent
6bf7411074
commit
0e07a0da68
@ -1,8 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:revanced_manager_flutter/theme.dart';
|
||||||
import 'package:revanced_manager_flutter/ui/screens/home_screen.dart';
|
import 'package:revanced_manager_flutter/ui/screens/home_screen.dart';
|
||||||
import 'package:revanced_manager_flutter/ui/screens/patcher_screen.dart';
|
import 'package:revanced_manager_flutter/ui/screens/patcher_screen.dart';
|
||||||
import 'constants.dart';
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@ -16,49 +15,8 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'ReVanced Manager',
|
title: 'ReVanced Manager',
|
||||||
theme: ThemeData.light().copyWith(
|
theme: lightTheme,
|
||||||
navigationBarTheme: NavigationBarThemeData(
|
darkTheme: darkTheme,
|
||||||
labelTextStyle: MaterialStateProperty.all(
|
|
||||||
GoogleFonts.roboto(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: Colors.red,
|
|
||||||
textTheme: GoogleFonts.interTextTheme(
|
|
||||||
Theme.of(context).textTheme,
|
|
||||||
),
|
|
||||||
useMaterial3: true,
|
|
||||||
colorScheme: const ColorScheme.light(
|
|
||||||
primary: purple40,
|
|
||||||
secondary: purpleGrey40,
|
|
||||||
tertiary: pink40,
|
|
||||||
background: Colors.red,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
darkTheme: ThemeData.dark().copyWith(
|
|
||||||
navigationBarTheme: NavigationBarThemeData(
|
|
||||||
iconTheme: MaterialStateProperty.all(const IconThemeData(
|
|
||||||
color: Colors.white,
|
|
||||||
)),
|
|
||||||
indicatorColor: const Color(0xff223144),
|
|
||||||
backgroundColor: const Color(0x1b222b6b),
|
|
||||||
labelTextStyle: MaterialStateProperty.all(
|
|
||||||
GoogleFonts.roboto(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: Colors.red,
|
|
||||||
useMaterial3: true,
|
|
||||||
scaffoldBackgroundColor: const Color(0xff0A0D11),
|
|
||||||
colorScheme: const ColorScheme.dark(
|
|
||||||
primary: purple80,
|
|
||||||
secondary: purpleGrey80,
|
|
||||||
tertiary: pink80,
|
|
||||||
background: Colors.red,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
home: const Navigation(),
|
home: const Navigation(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -74,8 +32,8 @@ class Navigation extends StatefulWidget {
|
|||||||
class _NavigationState extends State<Navigation> {
|
class _NavigationState extends State<Navigation> {
|
||||||
int currentPageIndex = 0;
|
int currentPageIndex = 0;
|
||||||
final List<Widget> screens = [
|
final List<Widget> screens = [
|
||||||
HomeScreen(),
|
const HomeScreen(),
|
||||||
PatcherScreen(),
|
const PatcherScreen(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
45
lib/theme.dart
Normal file
45
lib/theme.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:revanced_manager_flutter/constants.dart';
|
||||||
|
|
||||||
|
var lightTheme = ThemeData.light().copyWith(
|
||||||
|
navigationBarTheme: NavigationBarThemeData(
|
||||||
|
labelTextStyle: MaterialStateProperty.all(
|
||||||
|
GoogleFonts.roboto(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
useMaterial3: true,
|
||||||
|
colorScheme: const ColorScheme.light(
|
||||||
|
primary: purple40,
|
||||||
|
secondary: purpleGrey40,
|
||||||
|
tertiary: pink40,
|
||||||
|
background: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
var darkTheme = ThemeData.dark().copyWith(
|
||||||
|
navigationBarTheme: NavigationBarThemeData(
|
||||||
|
iconTheme: MaterialStateProperty.all(const IconThemeData(
|
||||||
|
color: Colors.white,
|
||||||
|
)),
|
||||||
|
indicatorColor: const Color(0xff223144),
|
||||||
|
backgroundColor: const Color(0x1b222b6b),
|
||||||
|
labelTextStyle: MaterialStateProperty.all(
|
||||||
|
GoogleFonts.roboto(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
useMaterial3: true,
|
||||||
|
scaffoldBackgroundColor: const Color(0xff0A0D11),
|
||||||
|
colorScheme: const ColorScheme.dark(
|
||||||
|
primary: purple80,
|
||||||
|
secondary: purpleGrey80,
|
||||||
|
tertiary: pink80,
|
||||||
|
background: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
@ -1,12 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/src/foundation/key.dart';
|
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
|
||||||
|
|
||||||
class PatcherScreen extends StatelessWidget {
|
class PatcherScreen extends StatelessWidget {
|
||||||
const PatcherScreen({Key? key}) : super(key: key);
|
const PatcherScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold();
|
return const Scaffold();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
lib/ui/widgets/app_details.dart
Normal file
51
lib/ui/widgets/app_details.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:revanced_manager_flutter/constants.dart';
|
||||||
|
import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart';
|
||||||
|
|
||||||
|
class AppDetails extends StatelessWidget {
|
||||||
|
final String asset;
|
||||||
|
final String name;
|
||||||
|
final String releaseDate;
|
||||||
|
|
||||||
|
const AppDetails({
|
||||||
|
Key? key,
|
||||||
|
required this.asset,
|
||||||
|
required this.name,
|
||||||
|
required this.releaseDate,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final isSVG = asset.endsWith(".svg");
|
||||||
|
return ListTile(
|
||||||
|
horizontalTitleGap: 12.0,
|
||||||
|
leading: isSVG
|
||||||
|
? SvgPicture.asset(
|
||||||
|
asset,
|
||||||
|
height: 24,
|
||||||
|
width: 24,
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
asset,
|
||||||
|
height: 39,
|
||||||
|
width: 39,
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
name,
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
color: const Color(0xff7792BA),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
releaseDate,
|
||||||
|
style: robotoTextStyle,
|
||||||
|
),
|
||||||
|
trailing: PatchTextButton(
|
||||||
|
text: "Patch",
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:revanced_manager_flutter/constants.dart';
|
import 'package:revanced_manager_flutter/ui/widgets/app_details.dart';
|
||||||
import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart';
|
import 'package:revanced_manager_flutter/ui/widgets/patch_text_button.dart';
|
||||||
|
|
||||||
class AvailableUpdatesWidget extends StatelessWidget {
|
class AvailableUpdatesWidget extends StatelessWidget {
|
||||||
@ -30,63 +29,22 @@ class AvailableUpdatesWidget extends StatelessWidget {
|
|||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
PatchTextButton(
|
||||||
|
text: "Patch all",
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: TextButton.styleFrom(
|
backgroundColor: const Color(0xff7792BA),
|
||||||
primary: Colors.white,
|
),
|
||||||
backgroundColor: const Color(0xff7792BA),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 8,
|
|
||||||
horizontal: 18,
|
|
||||||
),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(24),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: const Text("Patch all"),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ListTile(
|
const AppDetails(
|
||||||
horizontalTitleGap: 12.0,
|
asset: "lib/assets/images/revanced.svg",
|
||||||
leading: SvgPicture.asset(
|
name: "ReVanced",
|
||||||
"lib/assets/images/revanced.svg",
|
releaseDate: "2 days ago",
|
||||||
height: 26,
|
|
||||||
width: 26,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
"ReVanced",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
color: const Color(0xff7792BA),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
"Released 2 days ago",
|
|
||||||
style: robotoTextStyle,
|
|
||||||
),
|
|
||||||
trailing: PatchTextButton(
|
|
||||||
text: "Patch",
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
const AppDetails(
|
||||||
horizontalTitleGap: 12.0,
|
asset: "lib/assets/images/reddit.png",
|
||||||
leading: const Image(
|
name: "ReReddit",
|
||||||
image: AssetImage("lib/assets/images/reddit.png"),
|
releaseDate: "Released 1 month ago",
|
||||||
height: 39,
|
|
||||||
width: 39,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
"ReReddit",
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
color: const Color(0xff7792BA),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text("Released 1 month ago", style: robotoTextStyle),
|
|
||||||
trailing: PatchTextButton(
|
|
||||||
text: "Patch",
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user