forked from eatvio/eatvio_app
feat(issue-1154, issue-851): diary UX changed, price added to a active plan card
This commit is contained in:
@@ -39,12 +39,14 @@ class InsightsCard extends StatelessWidget {
|
||||
this.kbjuEnabled = InsightsFeatureFlags.kbjuEnabled,
|
||||
this.refreshToken = 0,
|
||||
this.initialIntraDate,
|
||||
this.showShadow = true,
|
||||
});
|
||||
|
||||
final String? slug;
|
||||
final bool canAdd;
|
||||
final InsightsRepository? repository;
|
||||
final bool kbjuEnabled;
|
||||
final bool showShadow;
|
||||
|
||||
/// При смене значения блок перезапрашивает данные (например, после правок
|
||||
/// в дневнике), сохраняя вкладку, период и выбранный день.
|
||||
@@ -68,6 +70,7 @@ class InsightsCard extends StatelessWidget {
|
||||
child: _InsightsView(
|
||||
refreshToken: refreshToken,
|
||||
initialIntraDate: initialIntraDate,
|
||||
showShadow: showShadow,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -78,10 +81,12 @@ class _InsightsView extends StatefulWidget {
|
||||
const _InsightsView({
|
||||
required this.refreshToken,
|
||||
required this.initialIntraDate,
|
||||
required this.showShadow,
|
||||
});
|
||||
|
||||
final int refreshToken;
|
||||
final String? initialIntraDate;
|
||||
final bool showShadow;
|
||||
|
||||
@override
|
||||
State<_InsightsView> createState() => _InsightsViewState();
|
||||
@@ -112,9 +117,13 @@ class _InsightsViewState extends State<_InsightsView> {
|
||||
builder: (context, state) {
|
||||
return switch (state) {
|
||||
InsightsStateLoaded() => _CardShell(
|
||||
showShadow: widget.showShadow,
|
||||
child: _LoadedContent(state: state),
|
||||
),
|
||||
InsightsStateError() => const _CardShell(child: _ErrorContent()),
|
||||
InsightsStateError() => _CardShell(
|
||||
showShadow: widget.showShadow,
|
||||
child: const _ErrorContent(),
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
},
|
||||
@@ -123,9 +132,10 @@ class _InsightsViewState extends State<_InsightsView> {
|
||||
}
|
||||
|
||||
class _CardShell extends StatelessWidget {
|
||||
const _CardShell({required this.child});
|
||||
const _CardShell({required this.child, required this.showShadow});
|
||||
|
||||
final Widget child;
|
||||
final bool showShadow;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -135,12 +145,13 @@ class _CardShell extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: InsightsColors.cardShadow,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
boxShadow: [
|
||||
if (showShadow)
|
||||
const BoxShadow(
|
||||
color: InsightsColors.cardShadow,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: child,
|
||||
|
||||
Reference in New Issue
Block a user