Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[auth] Implemented Banner widget

Aman Raj Singh Mouryaa4b14fe5b1d3
diff --git a/auth/assets/2.0x/calender_banner_dark.png b/auth/assets/2.0x/calender_banner_dark.png
new file mode 100644
index 0000000000..a289efa2ba
Binary files /dev/null and b/auth/assets/2.0x/calender_banner_dark.png differ
diff --git a/auth/assets/2.0x/calender_banner_light.png b/auth/assets/2.0x/calender_banner_light.png
new file mode 100644
index 0000000000..90bf194190
Binary files /dev/null and b/auth/assets/2.0x/calender_banner_light.png differ
diff --git a/auth/assets/2.0x/discount.png b/auth/assets/2.0x/discount.png
new file mode 100644
index 0000000000..50849d86b9
Binary files /dev/null and b/auth/assets/2.0x/discount.png differ
diff --git a/auth/assets/2.0x/ente_5gb.png b/auth/assets/2.0x/ente_5gb.png
new file mode 100644
index 0000000000..6db942841a
Binary files /dev/null and b/auth/assets/2.0x/ente_5gb.png differ
diff --git a/auth/assets/2.0x/rate_us.png b/auth/assets/2.0x/rate_us.png
new file mode 100644
index 0000000000..7ce29feb41
Binary files /dev/null and b/auth/assets/2.0x/rate_us.png differ
diff --git a/auth/assets/2.0x/star_us.png b/auth/assets/2.0x/star_us.png
new file mode 100644
index 0000000000..7f24dfd96b
Binary files /dev/null and b/auth/assets/2.0x/star_us.png differ
diff --git a/auth/assets/3.0x/calender_banner_dark.png b/auth/assets/3.0x/calender_banner_dark.png
new file mode 100644
index 0000000000..4d9bd8593e
Binary files /dev/null and b/auth/assets/3.0x/calender_banner_dark.png differ
diff --git a/auth/assets/3.0x/calender_banner_light.png b/auth/assets/3.0x/calender_banner_light.png
new file mode 100644
index 0000000000..82e8d9b141
Binary files /dev/null and b/auth/assets/3.0x/calender_banner_light.png differ
diff --git a/auth/assets/3.0x/discount.png b/auth/assets/3.0x/discount.png
new file mode 100644
index 0000000000..ee306d7cb4
Binary files /dev/null and b/auth/assets/3.0x/discount.png differ
diff --git a/auth/assets/3.0x/ente_5gb.png b/auth/assets/3.0x/ente_5gb.png
new file mode 100644
index 0000000000..b537a6d1e6
Binary files /dev/null and b/auth/assets/3.0x/ente_5gb.png differ
diff --git a/auth/assets/3.0x/rate_us.png b/auth/assets/3.0x/rate_us.png
new file mode 100644
index 0000000000..69ca1274c2
Binary files /dev/null and b/auth/assets/3.0x/rate_us.png differ
diff --git a/auth/assets/3.0x/star_us.png b/auth/assets/3.0x/star_us.png
new file mode 100644
index 0000000000..622acce646
Binary files /dev/null and b/auth/assets/3.0x/star_us.png differ
diff --git a/auth/assets/calender_banner_dark.png b/auth/assets/calender_banner_dark.png
new file mode 100644
index 0000000000..71c8025c60
Binary files /dev/null and b/auth/assets/calender_banner_dark.png differ
diff --git a/auth/assets/calender_banner_light.png b/auth/assets/calender_banner_light.png
new file mode 100644
index 0000000000..fa92b3f6f3
Binary files /dev/null and b/auth/assets/calender_banner_light.png differ
diff --git a/auth/assets/discount.png b/auth/assets/discount.png
new file mode 100644
index 0000000000..f9337389cc
Binary files /dev/null and b/auth/assets/discount.png differ
diff --git a/auth/assets/ente_5gb.png b/auth/assets/ente_5gb.png
new file mode 100644
index 0000000000..77e399bf86
Binary files /dev/null and b/auth/assets/ente_5gb.png differ
diff --git a/auth/assets/rate_us.png b/auth/assets/rate_us.png
new file mode 100644
index 0000000000..997491918e
Binary files /dev/null and b/auth/assets/rate_us.png differ
diff --git a/auth/assets/star_us.png b/auth/assets/star_us.png
new file mode 100644
index 0000000000..8bc4c41c87
Binary files /dev/null and b/auth/assets/star_us.png differ
diff --git a/auth/lib/ui/components/banner_widget.dart b/auth/lib/ui/components/banner_widget.dart
new file mode 100644
index 0000000000..6027dd430f
--- /dev/null
+++ b/auth/lib/ui/components/banner_widget.dart
@@ -0,0 +1,178 @@
+import 'package:dotted_border/dotted_border.dart';
+import 'package:ente_auth/theme/ente_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:styled_text/tags/styled_text_tag.dart';
+import 'package:styled_text/widgets/styled_text.dart';
+
+enum BannerType {
+ rateUs,
+ starUs,
+ freeStorage,
+ discount,
+}
+
+class BannerWidget extends StatelessWidget {
+ final String text;
+ final String? subText;
+ final BannerType type;
+ final TextStyle? mainTextStyle;
+
+ const BannerWidget({
+ super.key,
+ required this.text,
+ required this.type,
+ this.subText,
+ this.mainTextStyle,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ bool isLightMode =
+ MediaQuery.of(context).platformBrightness == Brightness.light;
+
+ final colorScheme = getEnteColorScheme(context);
+ Color dashColor;
+ List<BoxShadow>? boxShadow;
+ String rivePath;
+
+ switch (type) {
+ case BannerType.rateUs:
+ rivePath = "assets/rate_us.png";
+ dashColor = const Color.fromRGBO(255, 191, 12, 1);
+ boxShadow = [
+ BoxShadow(
+ color: const Color(0xFFFDB816).withOpacity(0.1),
+ blurRadius: 50,
+ spreadRadius: 80,
+ ),
+ BoxShadow(
+ color: const Color(0xFFFDB816).withOpacity(0.2),
+ blurRadius: 25,
+ ),
+ ];
+ break;
+ case BannerType.starUs:
+ rivePath = "assets/star_us.png";
+ dashColor = const Color.fromRGBO(233, 233, 233, 1);
+ boxShadow = [
+ BoxShadow(
+ color: const Color.fromRGBO(78, 78, 78, 1).withOpacity(0.2),
+ blurRadius: 50,
+ spreadRadius: 100,
+ ),
+ BoxShadow(
+ color: const Color.fromRGBO(23, 22, 22, 0.30).withOpacity(0.1),
+ blurRadius: 25,
+ ),
+ ];
+
+ case BannerType.freeStorage:
+ rivePath = "assets/ente_5gb.png";
+ dashColor = const Color.fromRGBO(29, 185, 84, 1);
+ boxShadow = [
+ BoxShadow(
+ color: const Color.fromRGBO(38, 203, 95, 1).withOpacity(0.08),
+ blurRadius: 50,
+ spreadRadius: 100,
+ ),
+ BoxShadow(
+ color: const Color.fromRGBO(0, 0, 0, 0.50).withOpacity(0.08),
+ blurRadius: 25,
+ ),
+ ];
+ case BannerType.discount:
+ dashColor = const Color.fromRGBO(29, 185, 84, 1);
+ rivePath = "assets/discount.png";
+ boxShadow = [
+ BoxShadow(
+ color: const Color.fromRGBO(38, 203, 95, 1).withOpacity(0.08),
+ blurRadius: 50,
+ spreadRadius: 100,
+ ),
+ BoxShadow(
+ color: const Color.fromRGBO(0, 0, 0, 0.50).withOpacity(0.08),
+ blurRadius: 25,
+ ),
+ ];
+ }
+ return ClipRRect(
+ borderRadius: const BorderRadius.all(Radius.circular(50)),
+ child: DottedBorder(
+ borderType: BorderType.RRect,
+ radius: const Radius.circular(50),
+ dashPattern: const <double>[3, 3],
+ color: dashColor,
+ child: Stack(
+ children: [
+ if (BannerType.starUs == type)
+ Positioned(
+ right: 0,
+ top: 0,
+ bottom: 0,
+ child: ClipRRect(
+ borderRadius: const BorderRadius.all(Radius.circular(50)),
+ child: isLightMode
+ ? Image.asset("assets/calender_banner_light.png")
+ : Image.asset("assets/calender_banner_dark.png"),
+ ),
+ ),
+ Row(
+ children: [
+ Stack(
+ alignment: Alignment.center,
+ children: [
+ if (!isLightMode)
+ Container(
+ height: 80,
+ width: 80,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ boxShadow: boxShadow,
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(10.0),
+ child: SizedBox(
+ height: 60,
+ width: 60,
+ child: Image.asset(rivePath),
+ ),
+ ),
+ ],
+ ),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ StyledText(
+ text: text,
+ style: getEnteTextTheme(context).large,
+ textAlign: TextAlign.left,
+ tags: {
+ 'bold-green': StyledTextTag(
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ color: colorScheme.primaryGreen,
+ ),
+ ),
+ },
+ ),
+ const SizedBox(height: 5),
+ Text(
+ subText ?? "",
+ textAlign: TextAlign.left,
+ style: const TextStyle(
+ color: Colors.grey,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}