iT邦幫忙

2023 iThome 鐵人賽

DAY 15
0
自我挑戰組

基礎學習Flutter系列 第 15

Day15-學習[Building for iOS with Flutter]子界面小部件(記錄)

  • 分享至 

  • xImage
  •  

新增數量拉桿、文字說明、數量顯示、選擇文件框

class-AddToLogFormState extends State<AddToLogForm> {
@override
Widget build(BuildContext context) {
final textTheme = AdaptiveTextTheme. of (context);

return Stack(
children: ‹Widget>[
ListView(
padding: MediaQuery.of(context).padding +
EdgeInsets. fromLTRB (24, 16, 24, 16),
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FlatCard(
child: ZoomClipAssetimage(
height: 112,
width: 112,
Zoom: 2.4,
imageAsset: widget.veggie.imageAssetPath,
), // SizedBox
),// FlatCard
SizedBox(width: 12),
Expanded(
child; Column(
crossAxisAlignment; CrossAxisAlignment.start,
children: [],
 Text(
  widget.veggie.name,
  style: textTheme.tileTitle,
  ),
  SizedBox(height: 2),
  Text(
   widget.veggie.categoryName,
   style: textTheme.label,
),// Text
].
),// Column
),// Expanded
},
). // Row

SizedBox(height: 8),
Line(),
CupertinoSegmentedControl(
children: {
0: Text('Breakfast'),
1: Text ('Lunch'),
2: Text ('Dinner'),
},
groupValue: _mealType,
onValueChanged: (type) => setState(() => _mealType = type),
), // CupertinoSegmentedControl

SizedBox (height: 32),
Row(
  crossAxisAlignment: CrossAxisAlignment.start,
  children: <widget>[
    SizedBox(
    width: 100,
    child: CupertinoTextField(
      controller: _servingsTextController,
      focusNode: _servingsfocusNode,
      textAlign: TextAlign.center,
      keyboardType: TextInputType.number,
      maxLength: 1,
      onChanged: (number) {
        if (number,isNotEmpty) {
        setStatel_servingsFocusNode.unfocus):
        ]
       },
     style: TextStyle(
     fontSize:34,
     fontweight: Fontweight.bold,
),
),
),
SizedBox (width: 24),
Column (
  crossAxisAlignment: CrossAxisAlignment.start.
  children:
    Text (
      'Servings of',
     style: textTheme, label,
     ).
SizedBox(height: 4),
Text(
  widget, veggie, servingsize,
  style: textTheme.body,
  ),
  },
  ),
  },
  ),
  SizedBox (height: 8),
  Row(
    children: (
      Padding(
        padding: EdgeInsets.all(12),
        child: Text('1', style: textTheme.bodySmall),
      ), // Padding Padding(
      Expanded(
        child; CupertinosSlider(
          value: nuberOfServings.toDouble(),
          min: 1,
          max: 10,
          divisions: 9,
          onChanged: (value) {
            setState(() => _servingsTextController.text =
              value.floor().toString());
              },
              ),
              ),
    Padding(
      padding: EdgeInsets.all(12),
      child: Text('10', style: textheme. bodysmall),
), // Padding
],
),// Row
SizedBox(height: 8),
line(),
QuoteText(text: widget.vegggie.shortDescription),
},
),
},
);
}
}
  

上一篇
Day14-學習[Building for iOS with Flutter]子界面輸入小部件(記錄)
下一篇
Day16-學習[Building for iOS with Flutter]子界面小部件(記錄)
系列文
基礎學習Flutter30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言