11import 'dart:async' ;
2- import 'dart:math' ;
32
43import 'package:flutter/cupertino.dart' ;
54import 'package:flutter/material.dart' ;
@@ -16,10 +15,8 @@ import 'package:smooth_app/pages/prices/price_meta_product.dart';
1615import 'package:smooth_app/pages/prices/prices_page.dart' ;
1716import 'package:smooth_app/pages/prices/product_price_add_page.dart' ;
1817import 'package:smooth_app/pages/prices/product_price_refresher.dart' ;
19- import 'package:smooth_app/resources/app_icons.dart' as icons;
2018import 'package:smooth_app/themes/smooth_theme.dart' ;
2119import 'package:smooth_app/themes/smooth_theme_colors.dart' ;
22- import 'package:smooth_app/themes/theme_provider.dart' ;
2320
2421/// Card that displays buttons related to prices.
2522class PricesCard extends StatelessWidget {
@@ -30,68 +27,30 @@ class PricesCard extends StatelessWidget {
3027 @override
3128 Widget build (BuildContext context) {
3229 final AppLocalizations appLocalizations = AppLocalizations .of (context);
33- final SmoothColorsThemeExtension themeExtension =
34- Theme .of (context).extension < SmoothColorsThemeExtension > ()! ;
35-
3630 return buildProductSmoothCard (
37- title: Stack (
38- children: < Widget > [
39- Positioned .directional (
40- textDirection: Directionality .of (context),
41- start: LARGE_SPACE ,
42- child: Container (
43- decoration: BoxDecoration (
44- color: themeExtension.secondaryVibrant,
45- shape: BoxShape .circle,
46- ),
47- padding: const EdgeInsetsDirectional .only (
48- top: 5.0 ,
49- start: 6.0 ,
50- end: 6.0 ,
51- bottom: 7.0 ,
52- ),
53- child: const icons.Lab (
54- size: 10.0 ,
55- color: Colors .white,
56- ),
57- ),
58- ),
59- const SizedBox (width: SMALL_SPACE ),
60- Center (child: Text (appLocalizations.prices_generic_title)),
61- ],
62- ),
31+ title: Text (appLocalizations.prices_generic_title),
6332 body: Container (
6433 width: double .infinity,
6534 padding: const EdgeInsetsDirectional .all (LARGE_SPACE ),
66- child: Stack (
35+ child: Column (
36+ crossAxisAlignment: CrossAxisAlignment .start,
37+ mainAxisAlignment: MainAxisAlignment .start,
6738 children: < Widget > [
68- Positioned .directional (
69- textDirection: Directionality .of (context),
70- bottom: 0.0 ,
71- end: 0.0 ,
72- child: const _PricesCardTitleIcon (),
39+ Padding (
40+ padding: const EdgeInsets .symmetric (horizontal: SMALL_SPACE ),
41+ child: _PricesCardViewButton (product),
7342 ),
74- Column (
75- crossAxisAlignment: CrossAxisAlignment .start,
76- mainAxisAlignment: MainAxisAlignment .start,
77- children: < Widget > [
78- Padding (
79- padding: const EdgeInsets .symmetric (horizontal: SMALL_SPACE ),
80- child: _PricesCardViewButton (product),
43+ Padding (
44+ padding: const EdgeInsets .all (SMALL_SPACE ),
45+ child: SmoothLargeButtonWithIcon (
46+ text: appLocalizations.prices_add_a_price,
47+ leadingIcon: const Icon (Icons .add),
48+ onPressed: () async => ProductPriceAddPage .showProductPage (
49+ context: context,
50+ product: PriceMetaProduct .product (product),
51+ proofType: ProofType .priceTag,
8152 ),
82- Padding (
83- padding: const EdgeInsets .all (SMALL_SPACE ),
84- child: SmoothLargeButtonWithIcon (
85- text: appLocalizations.prices_add_a_price,
86- leadingIcon: const Icon (Icons .add),
87- onPressed: () async => ProductPriceAddPage .showProductPage (
88- context: context,
89- product: PriceMetaProduct .product (product),
90- proofType: ProofType .priceTag,
91- ),
92- ),
93- ),
94- ],
53+ ),
9554 ),
9655 ],
9756 ),
@@ -105,25 +64,6 @@ class PricesCard extends StatelessWidget {
10564 }
10665}
10766
108- class _PricesCardTitleIcon extends StatelessWidget {
109- const _PricesCardTitleIcon ();
110-
111- @override
112- Widget build (BuildContext context) {
113- final SmoothColorsThemeExtension ? themeExtension =
114- Theme .of (context).extension < SmoothColorsThemeExtension > ();
115-
116- return Transform .rotate (
117- angle: - pi / 6 ,
118- child: icons.Lab (
119- size: 100.0 ,
120- color: themeExtension? .secondaryVibrant
121- .withValues (alpha: context.lightTheme () ? 0.15 : 0.4 ),
122- ),
123- );
124- }
125- }
126-
12767class _PricesCardViewButton extends StatefulWidget {
12868 const _PricesCardViewButton (this .product);
12969
0 commit comments