Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Use SegmentedButton instead of broken(UI) toggle in stripe subscription page

ashilkn10cb54ddc11c
diff --git a/mobile/lib/ui/payment/stripe_subscription_page.dart b/mobile/lib/ui/payment/stripe_subscription_page.dart
index 4a04d49d1a..0c63c71223 100644
--- a/mobile/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/lib/ui/payment/stripe_subscription_page.dart
@@ -537,21 +537,6 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
}
Widget _showSubscriptionToggle() {
- Widget planText(String title, bool reduceOpacity) {
- return Padding(
- padding: const EdgeInsets.only(left: 4, right: 4),
- child: Text(
- title,
- style: TextStyle(
- color: Theme.of(context)
- .colorScheme
- .onSurface
- .withOpacity(reduceOpacity ? 0.5 : 1.0),
- ),
- ),
- );
- }
-
return Container(
padding: const EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2),
margin: const EdgeInsets.only(bottom: 6),
@@ -561,18 +546,29 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- planText(S.of(context).monthly, _showYearlyPlan),
- Switch(
- value: _showYearlyPlan,
- activeColor: Colors.white,
- inactiveThumbColor: Colors.white,
- activeTrackColor: getEnteColorScheme(context).strokeMuted,
- onChanged: (value) async {
- _showYearlyPlan = value;
- await _filterStripeForUI();
+ SegmentedButton(
+ style: SegmentedButton.styleFrom(
+ selectedBackgroundColor:
+ getEnteColorScheme(context).fillMuted,
+ selectedForegroundColor:
+ getEnteColorScheme(context).textBase,
+ ),
+ segments: <ButtonSegment<bool>>[
+ ButtonSegment(
+ label: Text(S.of(context).monthly),
+ value: false,
+ ),
+ ButtonSegment(
+ label: Text(S.of(context).yearly),
+ value: true,
+ ),
+ ],
+ selected: {_showYearlyPlan},
+ onSelectionChanged: (p0) {
+ _showYearlyPlan = p0.first;
+ _filterStripeForUI();
},
),
- planText(S.of(context).yearly, !_showYearlyPlan),
],
),
),