使用圖像過濾器,新增磨砂玻璃的效果.
新增數據圖像顯示器,隨拉桿的增加或減少數量,圖像顯示也會改變.
新增按鈕,將數據回傳到日誌
int get numberofServings => int.parse(_servingsTextController,text) ;
int get totalCalories => widget.veggie.caloriesPerServing * numberofServings;
int get totalvitaminA => widget.veggie.vitaminAPercentage * numberofServings;
int get totalvitaminC => widget.veggie.vitaminCPercentage * numberofServings;
Padding(
padding: EdgeInsets.all(12),
child: Text('10', style: textheme. bodysmall),
), // Padding
],
),// Row
SizedBox(height: 8),
line(),
QuoteText(text: widget.vegggie.shortDescription),
},
),
Positioned(
bottom: MediaQuery.of(context).padding.bottom,
left: 0,
right: 0,
child: BlurredBackground(
intensity: 12,
color: Color(OxAAF2F2F2),
child: Padding(
padding: EdgeInsets.all (16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Summary(
calorise: totalCalories,
vitaminA: totalVitaminA,
vitaminC: totalVitaminc,
],
Container(
margin: EdgeInsets.only(top: 8)
alignment: Alignment.center,
child: CupertinoButton(
child: Text ('Add to Log'),
onPressed: () {
widget.onEntryCreated(LogEntry(
veggield: widget.veggie.id,
servings: numberofServings.floor(),
timestamp: DateTime.now(),
mealType: MealType.values[_mealType],
)): // LogEntry
},
), //CupertinoButton
)// Container
},
),
),
),
),
],
);
class BlurredBackground extends Statelesswidget {
const Blurredeackground( sthis.color, this.intensity = 25, this.child});
final Color color;
final double intensity:
final Widget child;
@override
Widget build(BuildContext context) {
return ClipRect(
filter: ImageFilter.blur(sigmaX: intensity, sigmaY: intensity),
child: DecoratedBox(
decoration: BoxDecoration(
color: color,
),
child: child,
),
),
);
}
}