This commit is contained in:
Márton Kiss
2023-05-26 21:25:00 +02:00
parent 9e3b805fdd
commit 1558794e93
528 changed files with 38239 additions and 37732 deletions

View File

@@ -1,142 +1,142 @@
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo_mobile_ui/premium/premium_screen.dart';
import 'package:filcnaplo_premium/models/premium_scopes.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/upsell.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class ActiveSponsorCard extends StatelessWidget {
const ActiveSponsorCard({super.key});
static PremiumFeatureLevel? estimateLevel(List<String> scopes) {
if (scopes.contains(PremiumScopes.all)) {
return PremiumFeatureLevel.tinta;
}
if (scopes.contains(PremiumScopes.timetableWidget) || scopes.contains(PremiumScopes.goalPlanner)) {
return PremiumFeatureLevel.tinta;
}
if (scopes.contains(PremiumScopes.customColors) || scopes.contains(PremiumScopes.nickname)) {
return PremiumFeatureLevel.kupak;
}
return null;
}
IconData _levelIcon(PremiumFeatureLevel level) {
switch (level) {
case PremiumFeatureLevel.kupak:
return FilcIcons.kupak;
case PremiumFeatureLevel.tinta:
return FilcIcons.tinta;
}
}
@override
Widget build(BuildContext context) {
final premium = Provider.of<PremiumProvider>(context, listen: false);
final level = estimateLevel(premium.scopes);
if (level == null) {
return const SizedBox();
}
Color glow;
switch (level) {
case PremiumFeatureLevel.kupak:
glow = Colors.lightGreen;
break;
case PremiumFeatureLevel.tinta:
glow = Colors.purple;
break;
}
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: glow.withOpacity(.4),
blurRadius: 42.0,
),
],
),
child: Card(
margin: EdgeInsets.zero,
elevation: 0,
color: const Color(0xff2B2B2B),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
splashColor: glow.withOpacity(.2),
onTap: () {
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(builder: (context) {
return const PremiumScreen();
}));
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Stack(
children: [
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage("https://github.com/${premium.login}.png?size=128"),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(3.0, 4.0),
child: Container(
padding: const EdgeInsets.all(4.0),
decoration: const BoxDecoration(
color: Color(0xff2B2B2B),
shape: BoxShape.circle,
),
child: const SizedBox(
height: 14.0,
width: 14.0,
),
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: SvgPicture.asset(
"assets/images/github.svg",
height: 14.0,
),
),
),
],
),
),
Expanded(
child: Text(
premium.login,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20, color: Colors.white),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(
_levelIcon(level),
color: Colors.white,
),
),
],
),
),
),
),
);
}
}
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo_mobile_ui/premium/premium_screen.dart';
import 'package:filcnaplo_premium/models/premium_scopes.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/upsell.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class ActiveSponsorCard extends StatelessWidget {
const ActiveSponsorCard({super.key});
static PremiumFeatureLevel? estimateLevel(List<String> scopes) {
if (scopes.contains(PremiumScopes.all)) {
return PremiumFeatureLevel.tinta;
}
if (scopes.contains(PremiumScopes.timetableWidget) || scopes.contains(PremiumScopes.goalPlanner)) {
return PremiumFeatureLevel.tinta;
}
if (scopes.contains(PremiumScopes.customColors) || scopes.contains(PremiumScopes.nickname)) {
return PremiumFeatureLevel.kupak;
}
return null;
}
IconData _levelIcon(PremiumFeatureLevel level) {
switch (level) {
case PremiumFeatureLevel.kupak:
return FilcIcons.kupak;
case PremiumFeatureLevel.tinta:
return FilcIcons.tinta;
}
}
@override
Widget build(BuildContext context) {
final premium = Provider.of<PremiumProvider>(context, listen: false);
final level = estimateLevel(premium.scopes);
if (level == null) {
return const SizedBox();
}
Color glow;
switch (level) {
case PremiumFeatureLevel.kupak:
glow = Colors.lightGreen;
break;
case PremiumFeatureLevel.tinta:
glow = Colors.purple;
break;
}
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: glow.withOpacity(.4),
blurRadius: 42.0,
),
],
),
child: Card(
margin: EdgeInsets.zero,
elevation: 0,
color: const Color(0xff2B2B2B),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
splashColor: glow.withOpacity(.2),
onTap: () {
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(builder: (context) {
return const PremiumScreen();
}));
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Stack(
children: [
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage("https://github.com/${premium.login}.png?size=128"),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(3.0, 4.0),
child: Container(
padding: const EdgeInsets.all(4.0),
decoration: const BoxDecoration(
color: Color(0xff2B2B2B),
shape: BoxShape.circle,
),
child: const SizedBox(
height: 14.0,
width: 14.0,
),
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: SvgPicture.asset(
"assets/images/github.svg",
height: 14.0,
),
),
),
],
),
),
Expanded(
child: Text(
premium.login,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20, color: Colors.white),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(
_levelIcon(level),
color: Colors.white,
),
),
],
),
),
),
),
);
}
}

View File

@@ -1,26 +1,26 @@
import 'package:flutter/material.dart';
class AvatarStack extends StatelessWidget {
const AvatarStack({Key? key, required this.children}) : super(key: key);
final List<Widget> children;
@override
Widget build(BuildContext context) {
return Stack(
children: [
if (children.isNotEmpty) children[0],
if (children.length > 1)
Transform.translate(
offset: const Offset(-20.0, 0.0),
child: children[1],
),
if (children.length > 2)
Transform.translate(
offset: const Offset(-40.0, 0.0),
child: children[2],
),
],
);
}
}
import 'package:flutter/material.dart';
class AvatarStack extends StatelessWidget {
const AvatarStack({Key? key, required this.children}) : super(key: key);
final List<Widget> children;
@override
Widget build(BuildContext context) {
return Stack(
children: [
if (children.isNotEmpty) children[0],
if (children.length > 1)
Transform.translate(
offset: const Offset(-20.0, 0.0),
child: children[1],
),
if (children.length > 2)
Transform.translate(
offset: const Offset(-40.0, 0.0),
child: children[2],
),
],
);
}
}

View File

@@ -1,52 +1,52 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class GithubCard extends StatelessWidget {
const GithubCard({super.key, this.onPressed});
final void Function()? onPressed;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
color: const Color(0xff2B2B2B),
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0).add(const EdgeInsets.only(top: 4.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Expanded(
child: Text(
"Támogass minket Githubon, hogy megszerezd a jutalmakat!",
style: TextStyle(color: Colors.white),
),
),
SvgPicture.asset("assets/images/github.svg"),
],
),
const SizedBox(height: 4.0),
Chip(
backgroundColor: Colors.black.withOpacity(.5),
label: const Text(
"Már támogatsz? Jelentkezz be!",
style: TextStyle(color: Colors.white),
),
),
],
),
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class GithubCard extends StatelessWidget {
const GithubCard({super.key, this.onPressed});
final void Function()? onPressed;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
color: const Color(0xff2B2B2B),
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0).add(const EdgeInsets.only(top: 4.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Expanded(
child: Text(
"Támogass minket Githubon, hogy megszerezd a jutalmakat!",
style: TextStyle(color: Colors.white),
),
),
SvgPicture.asset("assets/images/github.svg"),
],
),
const SizedBox(height: 4.0),
Chip(
backgroundColor: Colors.black.withOpacity(.5),
label: const Text(
"Már támogatsz? Jelentkezz be!",
style: TextStyle(color: Colors.white),
),
),
],
),
),
),
),
);
}
}

View File

@@ -1,97 +1,97 @@
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class GithubConnectButton extends StatelessWidget {
const GithubConnectButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final premium = Provider.of<PremiumProvider>(context);
return Card(
margin: EdgeInsets.zero,
elevation: 0,
color: const Color(0xff2B2B2B),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
onTap: () {
if (premium.hasPremium) {
premium.auth.refreshAuth(removePremium: true);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
"Prémium deaktiválva.",
style: TextStyle(color: AppColors.of(context).text, fontWeight: FontWeight.bold, fontSize: 18.0),
),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
));
return;
}
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return const PremiumActivationView();
}));
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Stack(
children: [
SvgPicture.asset(
"assets/images/github.svg",
height: 32.0,
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(3.0, 4.0),
child: Container(
padding: const EdgeInsets.all(4.0),
decoration: const BoxDecoration(
color: Color(0xff2B2B2B),
shape: BoxShape.circle,
),
child: const SizedBox(
height: 14.0,
width: 14.0,
),
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(2.0, 2.0),
child: Icon(
premium.hasPremium ? FeatherIcons.minusCircle : FeatherIcons.plusCircle,
color: Colors.white,
size: 16.0,
),
),
),
),
],
),
),
Text(
premium.hasPremium ? "GitHub szétkapcsolása" : "GitHub csatlakoztatása",
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20, color: Colors.white),
),
],
),
),
),
);
}
}
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class GithubConnectButton extends StatelessWidget {
const GithubConnectButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final premium = Provider.of<PremiumProvider>(context);
return Card(
margin: EdgeInsets.zero,
elevation: 0,
color: const Color(0xff2B2B2B),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
child: InkWell(
borderRadius: BorderRadius.circular(14.0),
onTap: () {
if (premium.hasPremium) {
premium.auth.refreshAuth(removePremium: true);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
"Prémium deaktiválva.",
style: TextStyle(color: AppColors.of(context).text, fontWeight: FontWeight.bold, fontSize: 18.0),
),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
));
return;
}
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return const PremiumActivationView();
}));
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Stack(
children: [
SvgPicture.asset(
"assets/images/github.svg",
height: 32.0,
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(3.0, 4.0),
child: Container(
padding: const EdgeInsets.all(4.0),
decoration: const BoxDecoration(
color: Color(0xff2B2B2B),
shape: BoxShape.circle,
),
child: const SizedBox(
height: 14.0,
width: 14.0,
),
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: Transform.translate(
offset: const Offset(2.0, 2.0),
child: Icon(
premium.hasPremium ? FeatherIcons.minusCircle : FeatherIcons.plusCircle,
color: Colors.white,
size: 16.0,
),
),
),
),
],
),
),
Text(
premium.hasPremium ? "GitHub szétkapcsolása" : "GitHub csatlakoztatása",
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 20, color: Colors.white),
),
],
),
),
),
);
}
}

View File

@@ -1,74 +1,74 @@
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);
final double progress;
final double target;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Cél: ${target.round()} támogató",
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0),
),
const SizedBox(height: 8.0),
Stack(
alignment: Alignment.center,
children: [
Container(
height: 12,
decoration: BoxDecoration(
color: Colors.black.withOpacity(.2),
borderRadius: BorderRadius.circular(45.0),
),
),
LayoutBuilder(
builder: (context, size) {
return Align(
alignment: Alignment.centerLeft,
child: Row(
children: [
Container(
height: 12,
width: size.maxWidth * (progress / 100),
decoration: BoxDecoration(
gradient: const LinearGradient(colors: [Color(0xFFFF2A9D), Color(0xFFFF37F7)]),
borderRadius: BorderRadius.circular(45.0),
),
),
Transform.translate(
offset: const Offset(-15.0, 0),
child: Stack(
children: [
ImageFiltered(
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"),
],
),
),
],
),
);
},
),
],
),
],
),
),
);
}
}
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);
final double progress;
final double target;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Cél: ${target.round()} támogató",
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0),
),
const SizedBox(height: 8.0),
Stack(
alignment: Alignment.center,
children: [
Container(
height: 12,
decoration: BoxDecoration(
color: Colors.black.withOpacity(.2),
borderRadius: BorderRadius.circular(45.0),
),
),
LayoutBuilder(
builder: (context, size) {
return Align(
alignment: Alignment.centerLeft,
child: Row(
children: [
Container(
height: 12,
width: size.maxWidth * (progress / 100),
decoration: BoxDecoration(
gradient: const LinearGradient(colors: [Color(0xFFFF2A9D), Color(0xFFFF37F7)]),
borderRadius: BorderRadius.circular(45.0),
),
),
Transform.translate(
offset: const Offset(-15.0, 0),
child: Stack(
children: [
ImageFiltered(
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

@@ -1,138 +1,138 @@
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class PremiumPlanCard extends StatelessWidget {
const PremiumPlanCard({
Key? key,
this.icon,
this.title,
this.description,
this.price = 0,
this.url,
this.gradient,
this.active = false,
}) : super(key: key);
final Widget? icon;
final Widget? title;
final int price;
final Widget? description;
final String? url;
final Gradient? gradient;
final bool active;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: InkWell(
customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
onTap: () {
if (url != null) {
launchUrl(
Uri.parse(url!),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (!active)
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (icon != null) ...[
IconTheme(
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),
child: title!,
),
],
),
)
else
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: Container(
decoration: BoxDecoration(
gradient: gradient,
borderRadius: BorderRadius.circular(99.0),
),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(99.0),
),
margin: const EdgeInsets.all(4.0),
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: const Text(
"Aktív",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
),
),
),
),
Text.rich(
TextSpan(children: [
TextSpan(text: "\$$price"),
TextSpan(
text: " / hó",
style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color!.withOpacity(.7)),
),
]),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0),
),
],
),
if (active) ...[
const SizedBox(height: 18.0),
Row(
children: [
if (icon != null) ...[
IconTheme(
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),
child: title!,
),
],
),
],
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),
child: description!,
),
],
),
),
),
);
}
}
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class PremiumPlanCard extends StatelessWidget {
const PremiumPlanCard({
Key? key,
this.icon,
this.title,
this.description,
this.price = 0,
this.url,
this.gradient,
this.active = false,
}) : super(key: key);
final Widget? icon;
final Widget? title;
final int price;
final Widget? description;
final String? url;
final Gradient? gradient;
final bool active;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: InkWell(
customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
onTap: () {
if (url != null) {
launchUrl(
Uri.parse(url!),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (!active)
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (icon != null) ...[
IconTheme(
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),
child: title!,
),
],
),
)
else
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: Container(
decoration: BoxDecoration(
gradient: gradient,
borderRadius: BorderRadius.circular(99.0),
),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(99.0),
),
margin: const EdgeInsets.all(4.0),
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: const Text(
"Aktív",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
),
),
),
),
Text.rich(
TextSpan(children: [
TextSpan(text: "\$$price"),
TextSpan(
text: " / hó",
style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color!.withOpacity(.7)),
),
]),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0),
),
],
),
if (active) ...[
const SizedBox(height: 18.0),
Row(
children: [
if (icon != null) ...[
IconTheme(
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),
child: title!,
),
],
),
],
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),
child: description!,
),
],
),
),
),
);
}
}

View File

@@ -1,64 +1,64 @@
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);
final String? imageKey;
final Widget? icon;
final Widget? title;
final Widget? description;
final bool soon;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (soon)
const Padding(
padding: EdgeInsets.only(left: 8.0),
child: Chip(
labelPadding: EdgeInsets.zero,
padding: EdgeInsets.symmetric(horizontal: 12.0),
backgroundColor: Color(0x777645D3),
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)),
child: Image.asset("assets/images/${imageKey!}.png"),
)
else
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row(
children: [
if (icon != null) ...[icon!, const SizedBox(width: 12.0)],
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontWeight: FontWeight.w700, fontSize: 20),
child: title!,
),
),
],
),
),
if (description != null)
Padding(
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),
child: description!,
),
),
],
),
);
}
}
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);
final String? imageKey;
final Widget? icon;
final Widget? title;
final Widget? description;
final bool soon;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (soon)
const Padding(
padding: EdgeInsets.only(left: 8.0),
child: Chip(
labelPadding: EdgeInsets.zero,
padding: EdgeInsets.symmetric(horizontal: 12.0),
backgroundColor: Color(0x777645D3),
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)),
child: Image.asset("assets/images/${imageKey!}.png"),
)
else
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row(
children: [
if (icon != null) ...[icon!, const SizedBox(width: 12.0)],
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontWeight: FontWeight.w700, fontSize: 20),
child: title!,
),
),
],
),
),
if (description != null)
Padding(
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),
child: description!,
),
),
],
),
);
}
}

View File

@@ -1,35 +1,35 @@
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);
final Supporter supporter;
@override
Widget build(BuildContext context) {
return Chip(
side: BorderSide.none,
shape: const StadiumBorder(side: BorderSide.none),
padding: const EdgeInsets.all(8.0),
avatar: supporter.avatar != ""
? CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(supporter.avatar),
)
: null,
labelPadding: const EdgeInsets.only(left: 12.0, right: 8.0),
label: Text.rich(
TextSpan(children: [
TextSpan(text: supporter.name),
if (supporter.type == DonationType.once)
TextSpan(
text: " \$${supporter.price}",
style: const TextStyle(fontWeight: FontWeight.w400),
),
]),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0),
),
);
}
}
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);
final Supporter supporter;
@override
Widget build(BuildContext context) {
return Chip(
side: BorderSide.none,
shape: const StadiumBorder(side: BorderSide.none),
padding: const EdgeInsets.all(8.0),
avatar: supporter.avatar != ""
? CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(supporter.avatar),
)
: null,
labelPadding: const EdgeInsets.only(left: 12.0, right: 8.0),
label: Text.rich(
TextSpan(children: [
TextSpan(text: supporter.name),
if (supporter.type == DonationType.once)
TextSpan(
text: " \$${supporter.price}",
style: const TextStyle(fontWeight: FontWeight.w400),
),
]),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0),
),
);
}
}

View File

@@ -1,71 +1,71 @@
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_chip.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_tile.dart';
import 'package:flutter/material.dart';
class SupporterGroupCard extends StatelessWidget {
const SupporterGroupCard({
Key? key,
this.title,
this.icon,
this.expanded = false,
this.supporters = const [],
this.glow,
}) : super(key: key);
final Widget? icon;
final Widget? title;
final bool expanded;
final List<Supporter> supporters;
final Color? glow;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
if (glow != null)
BoxShadow(
color: glow!.withOpacity(.2),
blurRadius: 60.0,
),
],
),
child: Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
if (icon != null) ...[icon!, const SizedBox(width: 12.0)],
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.titleLarge!.copyWith(fontWeight: FontWeight.w700),
child: title!,
),
),
],
),
const SizedBox(height: 12.0),
if (expanded)
Column(
children: supporters.map((e) => SupporterTile(supporter: e)).toList(),
)
else
Wrap(
spacing: 8.0,
children: supporters.map((e) => SupporterChip(supporter: e)).toList(),
),
],
),
),
),
);
}
}
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_chip.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_tile.dart';
import 'package:flutter/material.dart';
class SupporterGroupCard extends StatelessWidget {
const SupporterGroupCard({
Key? key,
this.title,
this.icon,
this.expanded = false,
this.supporters = const [],
this.glow,
}) : super(key: key);
final Widget? icon;
final Widget? title;
final bool expanded;
final List<Supporter> supporters;
final Color? glow;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
if (glow != null)
BoxShadow(
color: glow!.withOpacity(.2),
blurRadius: 60.0,
),
],
),
child: Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
if (icon != null) ...[icon!, const SizedBox(width: 12.0)],
if (title != null)
Expanded(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.titleLarge!.copyWith(fontWeight: FontWeight.w700),
child: title!,
),
),
],
),
const SizedBox(height: 12.0),
if (expanded)
Column(
children: supporters.map((e) => SupporterTile(supporter: e)).toList(),
)
else
Wrap(
spacing: 8.0,
children: supporters.map((e) => SupporterChip(supporter: e)).toList(),
),
],
),
),
),
);
}
}

View File

@@ -1,23 +1,23 @@
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);
final Supporter supporter;
@override
Widget build(BuildContext context) {
return ListTile(
contentPadding: EdgeInsets.zero,
leading: CircleAvatar(
backgroundImage: NetworkImage(supporter.avatar),
),
title: Text(
supporter.name,
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(supporter.comment),
);
}
}
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);
final Supporter supporter;
@override
Widget build(BuildContext context) {
return ListTile(
contentPadding: EdgeInsets.zero,
leading: CircleAvatar(
backgroundImage: NetworkImage(supporter.avatar),
),
title: Text(
supporter.name,
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(supporter.comment),
);
}
}

View File

@@ -1,70 +1,70 @@
import 'dart:math';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/avatar_stack.dart';
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);
final Future<Supporters?> supporters;
@override
Widget build(BuildContext context) {
return Card(
shape: const StadiumBorder(),
margin: EdgeInsets.zero,
child: InkWell(
customBorder: const StadiumBorder(),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => SupportersScreen(supporters: supporters)),
);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 14.0),
child: Row(
children: [
const Expanded(
child: Text(
"Köszönjük, támogatók!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0),
),
),
FutureBuilder<Supporters?>(
future: supporters,
builder: (context, snapshot) {
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()));
return AvatarStack(
children: [
// ignore: prefer_is_empty
if (sponsors.length > 0 && sponsors[0].avatar != "")
CircleAvatar(
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,
backgroundImage: NetworkImage(sponsors[1].avatar),
),
if (sponsors.length > 2 && sponsors[2].avatar != "")
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(sponsors[2].avatar),
),
],
);
}),
],
),
),
),
);
}
}
import 'dart:math';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/avatar_stack.dart';
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);
final Future<Supporters?> supporters;
@override
Widget build(BuildContext context) {
return Card(
shape: const StadiumBorder(),
margin: EdgeInsets.zero,
child: InkWell(
customBorder: const StadiumBorder(),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => SupportersScreen(supporters: supporters)),
);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 14.0),
child: Row(
children: [
const Expanded(
child: Text(
"Köszönjük, támogatók!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0),
),
),
FutureBuilder<Supporters?>(
future: supporters,
builder: (context, snapshot) {
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()));
return AvatarStack(
children: [
// ignore: prefer_is_empty
if (sponsors.length > 0 && sponsors[0].avatar != "")
CircleAvatar(
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,
backgroundImage: NetworkImage(sponsors[1].avatar),
),
if (sponsors.length > 2 && sponsors[2].avatar != "")
CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.secondary,
backgroundImage: NetworkImage(sponsors[2].avatar),
),
],
);
}),
],
),
),
),
);
}
}

View File

@@ -1,119 +1,119 @@
import 'dart:ui';
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo_mobile_ui/premium/premium_screen.dart';
import 'package:flutter/material.dart';
import 'package:animations/animations.dart';
class PremiumButton extends StatefulWidget {
const PremiumButton({Key? key}) : super(key: key);
@override
State<PremiumButton> createState() => _PremiumButtonState();
}
class _PremiumButtonState extends State<PremiumButton> with TickerProviderStateMixin {
late final AnimationController _animation;
bool _heldDown = false;
@override
void initState() {
super.initState();
_animation = AnimationController(vsync: this, duration: const Duration(seconds: 3));
_animation.repeat();
}
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return OpenContainer(
openColor: Theme.of(context).scaffoldBackgroundColor,
closedColor: Theme.of(context).scaffoldBackgroundColor,
clipBehavior: Clip.none,
transitionType: ContainerTransitionType.fadeThrough,
openElevation: 0,
closedElevation: 0,
closedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
openBuilder: (context, _) => const PremiumScreen(),
closedBuilder: (context, action) => GestureDetector(
onTapDown: (_) => setState(() => _heldDown = true),
onTapUp: (_) => setState(() => _heldDown = false),
onTapCancel: () => setState(() => _heldDown = false),
onTap: action,
child: Stack(
alignment: Alignment.center,
children: [
// RGB background animation
AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(14.0),
child: ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
height: 70,
decoration: BoxDecoration(
gradient: SweepGradient(colors: const [
Colors.blue,
Colors.orange,
Colors.purple,
Colors.blue,
], transform: GradientRotation(_animation.value * 6.283185)),
),
),
),
),
);
}),
// Button background & text
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 6.0, sigmaY: 6.0),
child: AnimatedScale(
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutBack,
scale: _heldDown ? 1.03 : 1,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 24.0),
width: double.infinity,
height: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14.0),
gradient: const LinearGradient(colors: [
Color(0xff124F3D),
Color(0xff1EA18F),
]),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(FilcIcons.premium, color: Colors.white),
SizedBox(width: 12.0),
Text(
"Filc Napló Premium",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
],
),
),
),
),
],
),
),
);
}
}
import 'dart:ui';
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo_mobile_ui/premium/premium_screen.dart';
import 'package:flutter/material.dart';
import 'package:animations/animations.dart';
class PremiumButton extends StatefulWidget {
const PremiumButton({Key? key}) : super(key: key);
@override
State<PremiumButton> createState() => _PremiumButtonState();
}
class _PremiumButtonState extends State<PremiumButton> with TickerProviderStateMixin {
late final AnimationController _animation;
bool _heldDown = false;
@override
void initState() {
super.initState();
_animation = AnimationController(vsync: this, duration: const Duration(seconds: 3));
_animation.repeat();
}
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return OpenContainer(
openColor: Theme.of(context).scaffoldBackgroundColor,
closedColor: Theme.of(context).scaffoldBackgroundColor,
clipBehavior: Clip.none,
transitionType: ContainerTransitionType.fadeThrough,
openElevation: 0,
closedElevation: 0,
closedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
openBuilder: (context, _) => const PremiumScreen(),
closedBuilder: (context, action) => GestureDetector(
onTapDown: (_) => setState(() => _heldDown = true),
onTapUp: (_) => setState(() => _heldDown = false),
onTapCancel: () => setState(() => _heldDown = false),
onTap: action,
child: Stack(
alignment: Alignment.center,
children: [
// RGB background animation
AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(14.0),
child: ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
height: 70,
decoration: BoxDecoration(
gradient: SweepGradient(colors: const [
Colors.blue,
Colors.orange,
Colors.purple,
Colors.blue,
], transform: GradientRotation(_animation.value * 6.283185)),
),
),
),
),
);
}),
// Button background & text
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 6.0, sigmaY: 6.0),
child: AnimatedScale(
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutBack,
scale: _heldDown ? 1.03 : 1,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 24.0),
width: double.infinity,
height: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14.0),
gradient: const LinearGradient(colors: [
Color(0xff124F3D),
Color(0xff1EA18F),
]),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(FilcIcons.premium, color: Colors.white),
SizedBox(width: 12.0),
Text(
"Filc Napló Premium",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
],
),
),
),
),
],
),
),
);
}
}

View File

@@ -1,292 +1,292 @@
import 'package:filcnaplo/api/client.dart';
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/active_sponsor_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/github_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/github_connect_button.dart';
import 'package:filcnaplo_mobile_ui/premium/components/goal_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/plan_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/reward_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporters_button.dart';
import 'package:filcnaplo_mobile_ui/premium/styles/gradients.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/upsell.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class PremiumScreen extends StatelessWidget {
const PremiumScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final middleColor =
Theme.of(context).brightness == Brightness.dark ? const Color.fromARGB(255, 20, 57, 46) : const Color.fromARGB(255, 10, 140, 123);
final future = FilcAPI.getSupporters();
return FutureBuilder<Supporters?>(
future: future,
builder: (context, snapshot) {
return Scaffold(
body: CustomScrollView(
physics: const ClampingScrollPhysics(),
slivers: [
SliverAppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
automaticallyImplyLeading: false,
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
const Color(0xff124F3D),
middleColor,
],
),
),
),
actions: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.close, color: Colors.white),
),
),
],
),
SliverPadding(
padding: const EdgeInsets.only(bottom: 25.0),
sliver: SliverToBoxAdapter(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
middleColor,
Theme.of(context).scaffoldBackgroundColor,
],
),
),
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 64.0),
Image.asset("assets/images/logo.png"),
const SizedBox(height: 12.0),
const Text(
"Még több filc.",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 25.0, color: Colors.white),
),
const Text(
"Filc Premium.",
style: TextStyle(fontWeight: FontWeight.w800, fontSize: 35.0, color: Colors.white),
),
const SizedBox(height: 15.0),
Text(
"Támogasd a filcet, és szerezz cserébe pár kényelmes jutalmat!",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: Colors.white.withOpacity(.8)),
),
const SizedBox(height: 25.0),
SupportersButton(supporters: future),
],
),
),
),
],
),
),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 24.0).add(const EdgeInsets.only(bottom: 100)),
sliver: SliverToBoxAdapter(
child: Column(
children: [
PremiumPlanCard(
icon: const Icon(FilcIcons.kupak),
title: Text("Kupak", style: TextStyle(foreground: GradientStyles.kupakPaint)),
gradient: GradientStyles.kupak,
price: 2,
description: const Text("Szabd személyre a filcet és láss részletesebb statisztikákat."),
url: "https://github.com/sponsors/filc/sponsorships?tier_id=238453&preview=true",
active: ActiveSponsorCard.estimateLevel(context.watch<PremiumProvider>().scopes) == PremiumFeatureLevel.kupak,
),
const SizedBox(height: 8.0),
PremiumPlanCard(
icon: const Icon(FilcIcons.tinta),
title: Text("Tinta", style: TextStyle(foreground: GradientStyles.tintaPaint)),
gradient: GradientStyles.tinta,
price: 5,
description: const Text("Kényelmesebb órarend, asztali alkalmazás és célok kitűzése."),
url: "https://github.com/sponsors/filc/sponsorships?tier_id=238454&preview=true",
active: ActiveSponsorCard.estimateLevel(context.watch<PremiumProvider>().scopes) == PremiumFeatureLevel.tinta,
),
const SizedBox(height: 12.0),
PremiumGoalCard(progress: snapshot.data?.progress ?? 0, target: snapshot.data?.max ?? 1),
const SizedBox(height: 12.0),
const GithubConnectButton(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
Icon(FilcIcons.kupak),
SizedBox(width: 12.0),
Expanded(
child: Text(
"Kupak jutalmak",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
PremiumRewardCard(
imageKey: "premium_nickname_showcase",
icon: SvgPicture.asset("assets/images/nickname_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Profil személyre szabás"),
description: const Text("Állíts be egy saját becenevet és egy profilképet (akár animáltat is!)"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_theme_showcase",
icon: SvgPicture.asset("assets/images/theme_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Téma+"),
description: const Text("Válassz saját háttérszínt és kártyaszínt is, akár saját HEX-kóddal!"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_stats_showcase",
icon: SvgPicture.asset("assets/images/stats_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Részletes jegy statisztika"),
description: const Text("Válassz heti, havi és háromhavi időtartam közül, és pontosan lásd, mennyi jegyed van."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még pár dolog..."),
description:
Text("🔣\tVálassz ikon témát\n\tPrémium rang és csevegő a discord szerverünkön\n📬\tElsőbbségi segítségnyújtás"),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
Icon(FilcIcons.tinta),
SizedBox(width: 12.0),
Expanded(
child: Text(
"Tinta jutalmak",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
PremiumRewardCard(
imageKey: "premium_timetable_showcase",
icon: SvgPicture.asset("assets/images/timetable_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Heti órarend nézet"),
description:
const Text("Egy órarend, ami a teljes képernyődet kihasználja, csak nem olyan idegesítő, mint az eKRÉTA féle."),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_widget_showcase",
icon: SvgPicture.asset("assets/images/widget_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Widget"),
description: const Text("Mindig lásd, milyen órád lesz, a kezdőképernyőd kényelméből."),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
soon: true,
imageKey: "premium_goal_showcase",
icon: SvgPicture.asset("assets/images/goal_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Cél követés"),
description: const Text("Add meg, mi a célod, és mi majd kiszámoljuk, hogyan juthatsz oda!"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
soon: true,
imageKey: "premium_desktop_showcase",
icon: SvgPicture.asset("assets/images/desktop_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Asztali verzió"),
description: const Text("Érd el a Filc Napló-t a gépeden is, és menekülj meg a csúnya felhasználói felületektől!"),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még pár dolog..."),
description: Text("🖋️\tMinden kupak jutalom\n\tKorai hozzáférés új verziókhoz"),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
SizedBox(width: 12.0),
Expanded(
child: Text(
"Mire vársz még?",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
GithubCard(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return const PremiumActivationView();
}));
},
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
SizedBox(width: 12.0),
Expanded(
child: Text(
"Gyakori kérdések",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
const PremiumRewardCard(
title: Text("Mire költitek a pénzt?"),
description: Text(
"A pénz elsősorban az appstore évi \$100-os díját fedezi, a maradék a szerver a weboldal és új funkciók fejlesztésére fordítjuk."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még mindig nyílt a forráskód?"),
description: Text(
"Igen, a Filc napló teljesen nyílt forráskódú, és ez így is fog maradni. A prémium funkciók forráskódjához hozzáférnek a támogatók."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Hol tudok támogatni?"),
description: Text(
"A támogatáshoz szükséged van egy Github profilra, amit hozzá kell kötnöd a filc naplóhoz. A Github “Sponsors” funkciója segítségével kezeljük az támogatásod."),
),
],
),
),
),
],
),
);
});
}
}
import 'package:filcnaplo/api/client.dart';
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_mobile_ui/premium/components/active_sponsor_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/github_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/github_connect_button.dart';
import 'package:filcnaplo_mobile_ui/premium/components/goal_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/plan_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/reward_card.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporters_button.dart';
import 'package:filcnaplo_mobile_ui/premium/styles/gradients.dart';
import 'package:filcnaplo_premium/providers/premium_provider.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:filcnaplo_premium/ui/mobile/premium/upsell.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
class PremiumScreen extends StatelessWidget {
const PremiumScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final middleColor =
Theme.of(context).brightness == Brightness.dark ? const Color.fromARGB(255, 20, 57, 46) : const Color.fromARGB(255, 10, 140, 123);
final future = FilcAPI.getSupporters();
return FutureBuilder<Supporters?>(
future: future,
builder: (context, snapshot) {
return Scaffold(
body: CustomScrollView(
physics: const ClampingScrollPhysics(),
slivers: [
SliverAppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
automaticallyImplyLeading: false,
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
const Color(0xff124F3D),
middleColor,
],
),
),
),
actions: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.close, color: Colors.white),
),
),
],
),
SliverPadding(
padding: const EdgeInsets.only(bottom: 25.0),
sliver: SliverToBoxAdapter(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
middleColor,
Theme.of(context).scaffoldBackgroundColor,
],
),
),
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 64.0),
Image.asset("assets/images/logo.png"),
const SizedBox(height: 12.0),
const Text(
"Még több filc.",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 25.0, color: Colors.white),
),
const Text(
"Filc Premium.",
style: TextStyle(fontWeight: FontWeight.w800, fontSize: 35.0, color: Colors.white),
),
const SizedBox(height: 15.0),
Text(
"Támogasd a filcet, és szerezz cserébe pár kényelmes jutalmat!",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: Colors.white.withOpacity(.8)),
),
const SizedBox(height: 25.0),
SupportersButton(supporters: future),
],
),
),
),
],
),
),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 24.0).add(const EdgeInsets.only(bottom: 100)),
sliver: SliverToBoxAdapter(
child: Column(
children: [
PremiumPlanCard(
icon: const Icon(FilcIcons.kupak),
title: Text("Kupak", style: TextStyle(foreground: GradientStyles.kupakPaint)),
gradient: GradientStyles.kupak,
price: 2,
description: const Text("Szabd személyre a filcet és láss részletesebb statisztikákat."),
url: "https://github.com/sponsors/filc/sponsorships?tier_id=238453&preview=true",
active: ActiveSponsorCard.estimateLevel(context.watch<PremiumProvider>().scopes) == PremiumFeatureLevel.kupak,
),
const SizedBox(height: 8.0),
PremiumPlanCard(
icon: const Icon(FilcIcons.tinta),
title: Text("Tinta", style: TextStyle(foreground: GradientStyles.tintaPaint)),
gradient: GradientStyles.tinta,
price: 5,
description: const Text("Kényelmesebb órarend, asztali alkalmazás és célok kitűzése."),
url: "https://github.com/sponsors/filc/sponsorships?tier_id=238454&preview=true",
active: ActiveSponsorCard.estimateLevel(context.watch<PremiumProvider>().scopes) == PremiumFeatureLevel.tinta,
),
const SizedBox(height: 12.0),
PremiumGoalCard(progress: snapshot.data?.progress ?? 0, target: snapshot.data?.max ?? 1),
const SizedBox(height: 12.0),
const GithubConnectButton(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
Icon(FilcIcons.kupak),
SizedBox(width: 12.0),
Expanded(
child: Text(
"Kupak jutalmak",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
PremiumRewardCard(
imageKey: "premium_nickname_showcase",
icon: SvgPicture.asset("assets/images/nickname_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Profil személyre szabás"),
description: const Text("Állíts be egy saját becenevet és egy profilképet (akár animáltat is!)"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_theme_showcase",
icon: SvgPicture.asset("assets/images/theme_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Téma+"),
description: const Text("Válassz saját háttérszínt és kártyaszínt is, akár saját HEX-kóddal!"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_stats_showcase",
icon: SvgPicture.asset("assets/images/stats_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Részletes jegy statisztika"),
description: const Text("Válassz heti, havi és háromhavi időtartam közül, és pontosan lásd, mennyi jegyed van."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még pár dolog..."),
description:
Text("🔣\tVálassz ikon témát\n\tPrémium rang és csevegő a discord szerverünkön\n📬\tElsőbbségi segítségnyújtás"),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
Icon(FilcIcons.tinta),
SizedBox(width: 12.0),
Expanded(
child: Text(
"Tinta jutalmak",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
PremiumRewardCard(
imageKey: "premium_timetable_showcase",
icon: SvgPicture.asset("assets/images/timetable_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Heti órarend nézet"),
description:
const Text("Egy órarend, ami a teljes képernyődet kihasználja, csak nem olyan idegesítő, mint az eKRÉTA féle."),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
imageKey: "premium_widget_showcase",
icon: SvgPicture.asset("assets/images/widget_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Widget"),
description: const Text("Mindig lásd, milyen órád lesz, a kezdőképernyőd kényelméből."),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
soon: true,
imageKey: "premium_goal_showcase",
icon: SvgPicture.asset("assets/images/goal_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Cél követés"),
description: const Text("Add meg, mi a célod, és mi majd kiszámoljuk, hogyan juthatsz oda!"),
),
const SizedBox(height: 14.0),
PremiumRewardCard(
soon: true,
imageKey: "premium_desktop_showcase",
icon: SvgPicture.asset("assets/images/desktop_icon.svg", color: Theme.of(context).iconTheme.color),
title: const Text("Asztali verzió"),
description: const Text("Érd el a Filc Napló-t a gépeden is, és menekülj meg a csúnya felhasználói felületektől!"),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még pár dolog..."),
description: Text("🖋️\tMinden kupak jutalom\n\tKorai hozzáférés új verziókhoz"),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
SizedBox(width: 12.0),
Expanded(
child: Text(
"Mire vársz még?",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
GithubCard(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) {
return const PremiumActivationView();
}));
},
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0).add(const EdgeInsets.only(top: 12.0)),
child: Row(
children: const [
SizedBox(width: 12.0),
Expanded(
child: Text(
"Gyakori kérdések",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
),
],
),
),
const PremiumRewardCard(
title: Text("Mire költitek a pénzt?"),
description: Text(
"A pénz elsősorban az appstore évi \$100-os díját fedezi, a maradék a szerver a weboldal és új funkciók fejlesztésére fordítjuk."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Még mindig nyílt a forráskód?"),
description: Text(
"Igen, a Filc napló teljesen nyílt forráskódú, és ez így is fog maradni. A prémium funkciók forráskódjához hozzáférnek a támogatók."),
),
const SizedBox(height: 14.0),
const PremiumRewardCard(
title: Text("Hol tudok támogatni?"),
description: Text(
"A támogatáshoz szükséged van egy Github profilra, amit hozzá kell kötnöd a filc naplóhoz. A Github “Sponsors” funkciója segítségével kezeljük az támogatásod."),
),
],
),
),
),
],
),
);
});
}
}

View File

@@ -1,13 +1,13 @@
import 'package:flutter/widgets.dart';
class GradientStyles {
static const tinta = LinearGradient(
colors: [Color(0xffB816E0), Color(0xff17D1BB)],
);
static final tintaPaint = Paint()..shader = tinta.createShader(const Rect.fromLTWH(0, 0, 200, 70));
static const kupak = LinearGradient(
colors: [Color(0xffF0BD0C), Color(0xff0CD070)],
);
static final kupakPaint = Paint()..shader = kupak.createShader(const Rect.fromLTWH(0, 0, 200, 70));
}
import 'package:flutter/widgets.dart';
class GradientStyles {
static const tinta = LinearGradient(
colors: [Color(0xffB816E0), Color(0xff17D1BB)],
);
static final tintaPaint = Paint()..shader = tinta.createShader(const Rect.fromLTWH(0, 0, 200, 70));
static const kupak = LinearGradient(
colors: [Color(0xffF0BD0C), Color(0xff0CD070)],
);
static final kupakPaint = Paint()..shader = kupak.createShader(const Rect.fromLTWH(0, 0, 200, 70));
}

View File

@@ -1,121 +1,121 @@
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_group_card.dart';
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);
final Future<Supporters?> supporters;
@override
Widget build(BuildContext context) {
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 patreonSupporters = snapshot.data?.patreon ?? [];
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar.large(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
title: const Text(
"Támogatók",
style: TextStyle(fontWeight: FontWeight.w700),
),
),
if (snapshot.hasData)
SliverPadding(
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)),
),
),
),
if (!snapshot.hasData)
const SliverPadding(
padding: EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator()),
),
),
if (highlightedSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Kiemelt támogatók"),
expanded: true,
supporters: highlightedSupporters,
),
),
),
if (tintaSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
icon: const Icon(FilcIcons.tinta),
title: Text(
"Tinta",
style: TextStyle(
foreground: GradientStyles.tintaPaint,
),
),
glow: Colors.purple,
supporters: tintaSupporters,
),
),
),
if (kupakSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
icon: const Icon(FilcIcons.kupak),
title: Text(
"Kupak",
style: TextStyle(foreground: GradientStyles.kupakPaint),
),
glow: Colors.lightGreen,
supporters: kupakSupporters,
),
),
),
if (onetimeSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Egyszeri támogatók"),
supporters: onetimeSupporters,
),
),
),
if (patreonSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Régebbi támogatóink"),
supporters: patreonSupporters,
),
),
),
],
),
);
});
}
}
import 'package:filcnaplo/icons/filc_icons.dart';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_mobile_ui/premium/components/supporter_group_card.dart';
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);
final Future<Supporters?> supporters;
@override
Widget build(BuildContext context) {
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 patreonSupporters = snapshot.data?.patreon ?? [];
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar.large(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
title: const Text(
"Támogatók",
style: TextStyle(fontWeight: FontWeight.w700),
),
),
if (snapshot.hasData)
SliverPadding(
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)),
),
),
),
if (!snapshot.hasData)
const SliverPadding(
padding: EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator()),
),
),
if (highlightedSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Kiemelt támogatók"),
expanded: true,
supporters: highlightedSupporters,
),
),
),
if (tintaSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
icon: const Icon(FilcIcons.tinta),
title: Text(
"Tinta",
style: TextStyle(
foreground: GradientStyles.tintaPaint,
),
),
glow: Colors.purple,
supporters: tintaSupporters,
),
),
),
if (kupakSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
icon: const Icon(FilcIcons.kupak),
title: Text(
"Kupak",
style: TextStyle(foreground: GradientStyles.kupakPaint),
),
glow: Colors.lightGreen,
supporters: kupakSupporters,
),
),
),
if (onetimeSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Egyszeri támogatók"),
supporters: onetimeSupporters,
),
),
),
if (patreonSupporters.isNotEmpty)
SliverPadding(
padding: const EdgeInsets.all(12.0),
sliver: SliverToBoxAdapter(
child: SupporterGroupCard(
title: const Text("Régebbi támogatóink"),
supporters: patreonSupporters,
),
),
),
],
),
);
});
}
}