fixed warnings (super.key, etc)

This commit is contained in:
Kima
2023-12-12 22:57:16 +01:00
parent fc3f538e6b
commit 6bac82f7d6
46 changed files with 349 additions and 228 deletions

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class AvatarStack extends StatelessWidget {
const AvatarStack({Key? key, required this.children}) : super(key: key);
const AvatarStack({super.key, required this.children});
final List<Widget> children;

View File

@@ -7,7 +7,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class GithubConnectButton extends StatelessWidget {
const GithubConnectButton({Key? key}) : super(key: key);
const GithubConnectButton({super.key});
@override
Widget build(BuildContext context) {
@@ -26,7 +26,10 @@ class GithubConnectButton extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
"Prémium deaktiválva.",
style: TextStyle(color: AppColors.of(context).text, fontWeight: FontWeight.bold, fontSize: 18.0),
style: TextStyle(
color: AppColors.of(context).text,
fontWeight: FontWeight.bold,
fontSize: 18.0),
),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
));
@@ -74,7 +77,9 @@ class GithubConnectButton extends StatelessWidget {
child: Transform.translate(
offset: const Offset(2.0, 2.0),
child: Icon(
premium.hasPremium ? FeatherIcons.minusCircle : FeatherIcons.plusCircle,
premium.hasPremium
? FeatherIcons.minusCircle
: FeatherIcons.plusCircle,
color: Colors.white,
size: 16.0,
),
@@ -85,8 +90,13 @@ class GithubConnectButton extends StatelessWidget {
),
),
Text(
premium.hasPremium ? "GitHub szétkapcsolása" : "GitHub csatlakoztatása",
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20, color: Colors.white),
premium.hasPremium
? "GitHub szétkapcsolása"
: "GitHub csatlakoztatása",
style: const TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: Colors.white),
),
],
),

View File

@@ -3,7 +3,7 @@ import 'dart:ui';
import 'package:flutter/material.dart';
class PremiumGoalCard extends StatelessWidget {
const PremiumGoalCard({Key? key, this.progress = 100, this.target = 1}) : super(key: key);
const PremiumGoalCard({super.key, this.progress = 100, this.target = 1});
final double progress;
final double target;
@@ -20,7 +20,8 @@ class PremiumGoalCard extends StatelessWidget {
children: [
Text(
"Cél: ${target.round()} támogató",
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0),
style:
const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0),
),
const SizedBox(height: 8.0),
Stack(
@@ -43,7 +44,10 @@ class PremiumGoalCard extends StatelessWidget {
height: 12,
width: size.maxWidth * (progress / 100),
decoration: BoxDecoration(
gradient: const LinearGradient(colors: [Color(0xFFFF2A9D), Color(0xFFFF37F7)]),
gradient: const LinearGradient(colors: [
Color(0xFFFF2A9D),
Color(0xFFFF37F7)
]),
borderRadius: BorderRadius.circular(45.0),
),
),
@@ -52,8 +56,10 @@ class PremiumGoalCard extends StatelessWidget {
child: Stack(
children: [
ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Image.asset("assets/images/heart.png", color: Colors.black.withOpacity(.3)),
imageFilter:
ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Image.asset("assets/images/heart.png",
color: Colors.black.withOpacity(.3)),
),
Image.asset("assets/images/heart.png"),
],

View File

@@ -4,7 +4,7 @@ import 'package:url_launcher/url_launcher.dart';
class PremiumPlanCard extends StatelessWidget {
const PremiumPlanCard({
Key? key,
super.key,
this.icon,
this.title,
this.description,
@@ -12,7 +12,7 @@ class PremiumPlanCard extends StatelessWidget {
this.url,
this.gradient,
this.active = false,
}) : super(key: key);
});
final Widget? icon;
final Widget? title;
@@ -28,7 +28,8 @@ class PremiumPlanCard extends StatelessWidget {
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: InkWell(
customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
customBorder:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
onTap: () {
if (url != null) {
launchUrl(
@@ -51,13 +52,20 @@ class PremiumPlanCard extends StatelessWidget {
children: [
if (icon != null) ...[
IconTheme(
data: Theme.of(context).iconTheme.copyWith(size: 42.0),
data: Theme.of(context)
.iconTheme
.copyWith(size: 42.0),
child: icon!,
),
const SizedBox(height: 12.0),
],
DefaultTextStyle(
style: Theme.of(context).textTheme.displaySmall!.copyWith(fontWeight: FontWeight.bold, fontSize: 25.0),
style: Theme.of(context)
.textTheme
.displaySmall!
.copyWith(
fontWeight: FontWeight.bold,
fontSize: 25.0),
child: title!,
),
],
@@ -78,7 +86,8 @@ class PremiumPlanCard extends StatelessWidget {
borderRadius: BorderRadius.circular(99.0),
),
margin: const EdgeInsets.all(4.0),
padding: const EdgeInsets.symmetric(horizontal: 12.0),
padding:
const EdgeInsets.symmetric(horizontal: 12.0),
child: const Text(
"Aktív",
style: TextStyle(
@@ -95,10 +104,16 @@ class PremiumPlanCard extends StatelessWidget {
TextSpan(text: "\$$price"),
TextSpan(
text: " / hó",
style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color!.withOpacity(.7)),
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyMedium!
.color!
.withOpacity(.7)),
),
]),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0),
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 24.0),
),
],
),
@@ -108,13 +123,15 @@ class PremiumPlanCard extends StatelessWidget {
children: [
if (icon != null) ...[
IconTheme(
data: Theme.of(context).iconTheme.copyWith(size: 24.0, color: AppColors.of(context).text),
data: Theme.of(context).iconTheme.copyWith(
size: 24.0, color: AppColors.of(context).text),
child: icon!,
),
],
const SizedBox(width: 12.0),
DefaultTextStyle(
style: Theme.of(context).textTheme.displaySmall!.copyWith(fontWeight: FontWeight.bold, fontSize: 25.0),
style: Theme.of(context).textTheme.displaySmall!.copyWith(
fontWeight: FontWeight.bold, fontSize: 25.0),
child: title!,
),
],
@@ -123,10 +140,13 @@ class PremiumPlanCard extends StatelessWidget {
const SizedBox(height: 6.0),
if (description != null)
DefaultTextStyle(
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(color: Theme.of(context).textTheme.bodyMedium!.color!.withOpacity(.8), fontSize: 18),
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context)
.textTheme
.bodyMedium!
.color!
.withOpacity(.8),
fontSize: 18),
child: description!,
),
],

View File

@@ -1,7 +1,13 @@
import 'package:flutter/material.dart';
class PremiumRewardCard extends StatelessWidget {
const PremiumRewardCard({Key? key, this.imageKey, this.icon, this.title, this.description, this.soon = false}) : super(key: key);
const PremiumRewardCard(
{super.key,
this.imageKey,
this.icon,
this.title,
this.description,
this.soon = false});
final String? imageKey;
final Widget? icon;
@@ -24,12 +30,14 @@ class PremiumRewardCard extends StatelessWidget {
labelPadding: EdgeInsets.zero,
padding: EdgeInsets.symmetric(horizontal: 12.0),
backgroundColor: Color(0x777645D3),
label: Text("Hamarosan", style: TextStyle(fontWeight: FontWeight.w500)),
label: Text("Hamarosan",
style: TextStyle(fontWeight: FontWeight.w500)),
),
),
if (imageKey != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 14.0).add(EdgeInsets.only(bottom: 12.0, top: soon ? 0 : 14.0)),
padding: const EdgeInsets.symmetric(horizontal: 14.0)
.add(EdgeInsets.only(bottom: 12.0, top: soon ? 0 : 14.0)),
child: Image.asset("assets/images/${imageKey!}.png"),
)
else
@@ -42,7 +50,10 @@ class PremiumRewardCard extends StatelessWidget {
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontWeight: FontWeight.w700, fontSize: 20),
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(fontWeight: FontWeight.w700, fontSize: 20),
child: title!,
),
),
@@ -51,9 +62,13 @@ class PremiumRewardCard extends StatelessWidget {
),
if (description != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0).add(const EdgeInsets.only(top: 4.0, bottom: 12.0)),
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.add(const EdgeInsets.only(top: 4.0, bottom: 12.0)),
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 16),
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(fontSize: 16),
child: description!,
),
),

View File

@@ -2,7 +2,7 @@ import 'package:filcnaplo/models/supporter.dart';
import 'package:flutter/material.dart';
class SupporterChip extends StatelessWidget {
const SupporterChip({Key? key, required this.supporter}) : super(key: key);
const SupporterChip({super.key, required this.supporter});
final Supporter supporter;

View File

@@ -5,13 +5,13 @@ import 'package:flutter/material.dart';
class SupporterGroupCard extends StatelessWidget {
const SupporterGroupCard({
Key? key,
super.key,
this.title,
this.icon,
this.expanded = false,
this.supporters = const [],
this.glow,
}) : super(key: key);
});
final Widget? icon;
final Widget? title;
@@ -34,7 +34,8 @@ class SupporterGroupCard extends StatelessWidget {
),
child: Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
@@ -46,7 +47,10 @@ class SupporterGroupCard extends StatelessWidget {
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.titleLarge!.copyWith(fontWeight: FontWeight.w700),
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontWeight: FontWeight.w700),
child: title!,
),
),
@@ -55,12 +59,16 @@ class SupporterGroupCard extends StatelessWidget {
const SizedBox(height: 12.0),
if (expanded)
Column(
children: supporters.map((e) => SupporterTile(supporter: e)).toList(),
children: supporters
.map((e) => SupporterTile(supporter: e))
.toList(),
)
else
Wrap(
spacing: 8.0,
children: supporters.map((e) => SupporterChip(supporter: e)).toList(),
children: supporters
.map((e) => SupporterChip(supporter: e))
.toList(),
),
],
),

View File

@@ -2,7 +2,7 @@ import 'package:filcnaplo/models/supporter.dart';
import 'package:flutter/material.dart';
class SupporterTile extends StatelessWidget {
const SupporterTile({Key? key, required this.supporter}) : super(key: key);
const SupporterTile({super.key, required this.supporter});
final Supporter supporter;

View File

@@ -6,7 +6,7 @@ import 'package:filcnaplo_mobile_ui/premium/supporters_screen.dart';
import 'package:flutter/material.dart';
class SupportersButton extends StatelessWidget {
const SupportersButton({Key? key, required this.supporters}) : super(key: key);
const SupportersButton({super.key, required this.supporters});
final Future<Supporters?> supporters;
@@ -19,7 +19,8 @@ class SupportersButton extends StatelessWidget {
customBorder: const StadiumBorder(),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => SupportersScreen(supporters: supporters)),
MaterialPageRoute(
builder: (context) => SupportersScreen(supporters: supporters)),
);
},
child: Container(
@@ -38,24 +39,35 @@ class SupportersButton extends StatelessWidget {
if (!snapshot.hasData) {
return const SizedBox();
}
final sponsors = snapshot.data!.github.where((e) => e.type == DonationType.monthly).toList();
sponsors.shuffle(Random((DateTime.now().millisecondsSinceEpoch / 1000 / 60 / 60 / 24).floor()));
final sponsors = snapshot.data!.github
.where((e) => e.type == DonationType.monthly)
.toList();
sponsors.shuffle(Random(
(DateTime.now().millisecondsSinceEpoch /
1000 /
60 /
60 /
24)
.floor()));
return AvatarStack(
children: [
// ignore: prefer_is_empty
if (sponsors.length > 0 && sponsors[0].avatar != "")
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor:
Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(sponsors[0].avatar),
),
if (sponsors.length > 1 && sponsors[1].avatar != "")
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor:
Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(sponsors[1].avatar),
),
if (sponsors.length > 2 && sponsors[2].avatar != "")
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundColor:
Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(sponsors[2].avatar),
),
],

View File

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:animations/animations.dart';
class PremiumButton extends StatefulWidget {
const PremiumButton({Key? key}) : super(key: key);
const PremiumButton({super.key});
@override
State<PremiumButton> createState() => _PremiumButtonState();

View File

@@ -17,7 +17,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class PremiumScreen extends StatelessWidget {
const PremiumScreen({Key? key}) : super(key: key);
const PremiumScreen({super.key});
@override
Widget build(BuildContext context) {

View File

@@ -6,7 +6,7 @@ import 'package:filcnaplo_mobile_ui/premium/styles/gradients.dart';
import 'package:flutter/material.dart';
class SupportersScreen extends StatelessWidget {
const SupportersScreen({Key? key, required this.supporters}) : super(key: key);
const SupportersScreen({super.key, required this.supporters});
final Future<Supporters?> supporters;
@@ -15,12 +15,28 @@ class SupportersScreen extends StatelessWidget {
return FutureBuilder<Supporters?>(
future: supporters,
builder: (context, snapshot) {
final highlightedSupporters =
snapshot.data?.github.where((e) => e.type == DonationType.monthly && e.price >= 5 && e.comment != "").toList() ?? [];
final tintaSupporters =
snapshot.data?.github.where((e) => e.type == DonationType.monthly && e.price >= 5 && e.comment == "").toList() ?? [];
final kupakSupporters = snapshot.data?.github.where((e) => e.type == DonationType.monthly && e.price == 2).toList() ?? [];
final onetimeSupporters = snapshot.data?.github.where((e) => e.type == DonationType.once && e.price >= 5).toList() ?? [];
final highlightedSupporters = snapshot.data?.github
.where((e) =>
e.type == DonationType.monthly &&
e.price >= 5 &&
e.comment != "")
.toList() ??
[];
final tintaSupporters = snapshot.data?.github
.where((e) =>
e.type == DonationType.monthly &&
e.price >= 5 &&
e.comment == "")
.toList() ??
[];
final kupakSupporters = snapshot.data?.github
.where((e) => e.type == DonationType.monthly && e.price == 2)
.toList() ??
[];
final onetimeSupporters = snapshot.data?.github
.where((e) => e.type == DonationType.once && e.price >= 5)
.toList() ??
[];
final patreonSupporters = snapshot.data?.patreon ?? [];
return Scaffold(
@@ -35,11 +51,15 @@ class SupportersScreen extends StatelessWidget {
),
if (snapshot.hasData)
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0).add(const EdgeInsets.only(bottom: 24.0)),
padding: const EdgeInsets.symmetric(horizontal: 16.0)
.add(const EdgeInsets.only(bottom: 24.0)),
sliver: SliverToBoxAdapter(
child: Text(
snapshot.data!.description,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0, color: AppColors.of(context).text.withOpacity(.7)),
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 20.0,
color: AppColors.of(context).text.withOpacity(.7)),
),
),
),
@@ -86,7 +106,8 @@ class SupportersScreen extends StatelessWidget {
icon: const Icon(FilcIcons.kupak),
title: Text(
"Kupak",
style: TextStyle(foreground: GradientStyles.kupakPaint),
style:
TextStyle(foreground: GradientStyles.kupakPaint),
),
glow: Colors.lightGreen,
supporters: kupakSupporters,