This commit is contained in:
Dmitry 2024-08-25 01:08:37 +03:00
parent 51ae2ce36c
commit b7794408f8
6 changed files with 30 additions and 10 deletions

View file

@ -195,7 +195,7 @@ class AddPromocodeCampaign {
); );
}, },
description: description:
r'$d - digit $l - letter', r'$d - digit $l - letter $s - any',
), ),
IntParam( IntParam(
'Generation size', 'Generation size',

View file

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:mnemo_cards_common/mnemo_cards_common.dart'; import 'package:mnemo_cards_common/mnemo_cards_common.dart';
@ -19,8 +18,16 @@ class SubscriptionPage extends StatelessWidget {
body: Column( body: Column(
children: [ children: [
Header(dto.title, hasPopButton: true, center: true), Header(dto.title, hasPopButton: true, center: true),
...dto.items.build(), Expanded(
...dto.plans.map(_SubscriptionPlanWidget.new), child: Column(
// shrinkWrap: true,
// physics: PageScrollPhysics(),
children: [
...dto.items.build(),
...dto.plans.map(_SubscriptionPlanWidget.new),
],
),
),
BigBackButton(), BigBackButton(),
], ],
), ),

View file

@ -78,10 +78,10 @@ class ProfilePage extends StatelessWidget {
), ),
Expanded( Expanded(
child: ListView( child: ListView(
physics: FixedExtentScrollPhysics(), physics: PageScrollPhysics(),
children: [ children: [
SizedBox( SizedBox(
height: 300.h, height: 320.h,
child: StreamBuilder( child: StreamBuilder(
stream: locator.userManager.userStateHolder.asStream, stream: locator.userManager.userStateHolder.asStream,
builder: (context, snapshot) { builder: (context, snapshot) {

View file

@ -23,6 +23,15 @@ import '../widgets/shared_pref_button.dart';
@RoutePage() @RoutePage()
class SettingsPage extends StatelessWidget { class SettingsPage extends StatelessWidget {
void _initAdmin() {
if (!getIt.isRegistered<AdminApi>()) {
getIt.registerLazySingleton<AdminApi>(
() => AdminApi(getIt.get<DioProvider>().dio));
print('set admin');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Analytics.settingsPageOpened(locator.userManager.userStateHolder.user); Analytics.settingsPageOpened(locator.userManager.userStateHolder.user);
@ -129,10 +138,8 @@ class SettingsPage extends StatelessWidget {
), ),
setOnTap: (v) { setOnTap: (v) {
final val = !(v ?? false); final val = !(v ?? false);
if (val && !getIt.isRegistered<AdminApi>()) { if (val) {
getIt.registerLazySingleton<AdminApi>( _initAdmin();
() => AdminApi(getIt.get<DioProvider>().dio));
print('set admin');
} }
return val; return val;
}, },
@ -179,24 +186,28 @@ class SettingsPage extends StatelessWidget {
SimpleTile.text( SimpleTile.text(
text: 'Cards', text: 'Cards',
onTap: () { onTap: () {
_initAdmin();
showDialog(context: context, builder: (c) => const AllCards()); showDialog(context: context, builder: (c) => const AllCards());
}, },
), ),
SimpleTile.text( SimpleTile.text(
text: 'Users', text: 'Users',
onTap: () { onTap: () {
_initAdmin();
showDialog(context: context, builder: (c) => const AllUsers()); showDialog(context: context, builder: (c) => const AllUsers());
}, },
), ),
SimpleTile.text( SimpleTile.text(
text: 'Plans', text: 'Plans',
onTap: () { onTap: () {
_initAdmin();
AddPlan().addPlan(context); AddPlan().addPlan(context);
}, },
), ),
SimpleTile.text( SimpleTile.text(
text: 'Promo codes', text: 'Promo codes',
onTap: () { onTap: () {
_initAdmin();
AddPromocodeCampaign().addCampaign(context); AddPromocodeCampaign().addCampaign(context);
}, },
), ),

View file

@ -35,6 +35,8 @@ class BuyPack extends StatelessWidget {
CardPackHeader(dto.title, dto.subtitle, dto.color?.asColor), CardPackHeader(dto.title, dto.subtitle, dto.color?.asColor),
Expanded( Expanded(
child: Column( child: Column(
// physics: PageScrollPhysics(),
// shrinkWrap: true,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(