<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Flutter筆記-基礎組件

      圖片和Icon

      加載網絡圖片以及本地圖片
       Image(
                    image: NetworkImage(
                        "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB12IU4R.img?w=80&h=80&m=4&q=60"),
                    width: 100.0,
                  ),
                  Image(image: AssetImage("graphics/ic_launcher.png"),
                    width: 100.0,
                    height: 100.0,
                  )
      
      color和colorBlendMode 進行顏色混合處理
       Image(
                    image: AssetImage("graphics/ic_launcher.png"),
                    width: 100.0,
                    height: 100.0,
                    color: Colors.blue,
                    colorBlendMode: BlendMode.difference,
                  )
      

      整體的例子:
      加載網絡圖片

      import 'package:flutter/cupertino.dart';
      
      class ImageAndIconRoute extends StatelessWidget {
        @override
        Widget build(BuildContext context) {
          var assetImage = AssetImage("graphics/ic_launcher.png");
          return SingleChildScrollView(
            child: Column(
                children: <Image>[
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.fill,
              ),
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.contain,
              ),
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.cover,
              ),
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.fitWidth,
              ),
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.fitHeight,
              ),
              Image(
                image: assetImage,
                width: 100,
                height: 100,
                fit: BoxFit.none,
              ),
            ].map((e) {
              return Row(
                children: <Widget>[
                  Padding(
                    padding: EdgeInsets.all(16.0),
                    child: SizedBox(
                      width: 100,
                      child: e,
                    ),
                  ),
                  Text(e.fit.toString())
                ],
              );
            }).toList()),
          );
        }
      }
      
      

      單選開關和復選框

      switch和checkbox,繼承StateLessWidget
      點擊switch和checkbox會觸發onchange回調

      import 'package:flutter/material.dart';
      // StatefulWidget 維護狀態需要繼承這個
      class SwitchAndCheckboxRoute extends StatefulWidget{
        const SwitchAndCheckboxRoute({super.key});
      
        @override
        SwitchAndCheckboxRouteSate createState() => SwitchAndCheckboxRouteSate();
      }
      
      class SwitchAndCheckboxRouteSate extends State<SwitchAndCheckboxRoute>{
        bool switchSelected = true;
        bool checkboxSelected = true;
        @override
        Widget build(BuildContext context) {
        return Column(
          children: <Widget>[
            Switch(
              value:switchSelected, onChanged: (bool value) {
                setState(() {
                  switchSelected = value;
                });
            },),
            Checkbox(value: checkboxSelected,
              activeColor: Colors.red,
              onChanged: (bool? value) {
              setState(() {
                checkboxSelected = value!;
              });
            },
            )
          ],
        );
        }
      }
      
      輸入框以及表單

      輸入框組件TextField

      1. TextEditingController 編輯框控制器,設置,獲取,選擇,監聽文本改變事件。
      2. FucusNode 是否占有鍵盤焦點。
      3. InputDecoration TextField外觀顯示,提示文本,背景顏色,邊框等。
      4. KeyboardType 鍵盤輸入類型
      • text 文件輸入鍵盤
      • multiline 多行文本
      • number 數字鍵盤
      • phone 電話號碼鍵盤
      • datatime 日期輸入鍵盤
      • emailAddress 電子郵件
      • url url輸入鍵盤

      輸入框例子:

                  Column(
                    children: const <Widget>[
                      TextField(
                        autofocus: true,
                        decoration: InputDecoration(
                          labelText: "用戶名",
                          hintText: "請輸入用戶名",
                          prefixIcon: Icon(Icons.person)
                        ),
                      ),
                      TextField(
                        autofocus: true,
                        decoration: InputDecoration(
                            labelText: "密碼",
                            hintText: "請輸入密碼",
                            prefixIcon: Icon(Icons.lock)
                        ),
                        obscureText: true,
                      )
      
                    ],
                  )
      

      效果
      image

      控制焦點
      import 'package:flutter/material.dart';
      
      class FocusTestRoute extends StatefulWidget{
        const FocusTestRoute({super.key});
      
        @override
        FocusTestRouteState createState()=>FocusTestRouteState();
      }
      
      class FocusTestRouteState extends State<FocusTestRoute>{
        // FocusNode 控制焦點用
        FocusNode focusNode1 = FocusNode();
        FocusNode focusNode2 = FocusNode();
        // 移動焦點,設置默認焦點用
        late FocusScopeNode focusScopeNode;
      
        @override
        Widget build(BuildContext context) {
         return  Padding(
           padding: const EdgeInsets.all(16.0),
        child: Column(
            children: <Widget>[
              TextField(
                autofocus: true,
                focusNode: focusNode1,
                decoration: const InputDecoration(
                  labelText: "input1"
                ),
              ),
              TextField(
                focusNode: focusNode2,
                decoration: const InputDecoration(
                  labelText: "input2"
                ),
              ),
              Builder(builder: (ctx){
                return Column(
                  children: <Widget>[
                    TextButton(
                      child: const Text("移動焦點"),
                      onPressed: (){
                      if(null==focusScopeNode){
                        focusScopeNode = FocusScope.of(context);
                      }else{
                        // 焦點移動到第二個TextField
                        focusScopeNode.requestFocus(focusNode2);
                      }
                      },
                    ),
                    TextButton(
                      child: const Text("隱藏鍵盤"),
                      onPressed: (){
                        focusNode1.unfocus();
                        focusNode2.unfocus();
                      },
                    )
                  ],
                );
              })
            ],
        ),
         );
        }
      }
      
      進度條

      LinearProgressIndicator 橫向進度條
      valueColor 進度條顏色
      value 進度

       LinearProgressIndicator(
                    backgroundColor: Colors.grey[200],
                    valueColor: const AlwaysStoppedAnimation(Colors.blue),
                  ),
                  LinearProgressIndicator(
                    backgroundColor: Colors.grey[200],
                    valueColor: const AlwaysStoppedAnimation(Colors.blue),
                    value: 0.5,
                  )
      

      圓形進度條

      CircularProgressIndicator(
                  backgroundColor: Colors.grey[200],
                  valueColor: const AlwaysStoppedAnimation(Colors.blue),
                  value: .5,
                  )
      

      指定進度條寬高SizedBox

      SizedBox(
                    height: 10,
                    child: LinearProgressIndicator(
                      backgroundColor: Colors.grey[200],
                      valueColor: const AlwaysStoppedAnimation(Colors.blue),
                    ),
                  ),
      

      10s由綠變紅例子

      import 'package:flutter/material.dart';
      
      class ProgressRoute extends StatefulWidget {
        const ProgressRoute({super.key});
      
        @override
        ProgressRouteState createState() => ProgressRouteState();
      }
      
      class ProgressRouteState extends State<ProgressRoute>
          with SingleTickerProviderStateMixin {
        late AnimationController animationController;
      
        @override
        initState() {
          animationController =
              AnimationController(vsync: this, duration: const Duration(seconds: 10));
          animationController.forward();
          animationController.addListener(() => setState(() {}));
          super.initState();
        }
      
        @override
        void dispose() {
          animationController.dispose();
          super.dispose();
        }
      
        @override
        Widget build(BuildContext context) {
          return SingleChildScrollView(
            child: Column(
              children: <Widget>[
                Padding(padding: const EdgeInsets.all(16),
                    child: LinearProgressIndicator(
                      backgroundColor: Colors.grey[200],
                      valueColor: ColorTween(begin: Colors.green, end: Colors.red).animate(animationController),
                      value: animationController.value,
                    )
                ),
      
              ],
            ),
          );
        }
      }
      
      
      posted @ 2023-02-11 11:01  西北野狼  閱讀(62)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 一本无码av中文出轨人妻| 国产精品免费视频不卡| 精品一区二区免费不卡| 青青草无码免费一二三区| 好男人好资源WWW社区| 国产精品毛片在线完整版| 國产AV天堂| 四虎亚洲国产成人久久精品| 日本免费一区二区三区最新vr| 天堂av资源在线免费| 亚洲精品久久久久国色天香 | 榆林市| 国产中文字幕一区二区| 国产成人亚洲综合图区| 久久精品国产亚洲精品2020| 国产精品无码a∨精品| 亚洲人成网站在线播放2019| 国产一区二区午夜福利久久| 免费拍拍拍网站| 亚洲中文字幕有综合久久| 中文字幕国产精品资源| 国产美女自卫慰黄网站| 熟女视频一区二区三区嫩草| 4虎四虎永久在线精品免费| 丁香五月亚洲综合深深爱| 成人无遮挡裸免费视频在线观看| 久久爱在线视频在线观看| 亚洲乱码av中文一区二区| 蜜臀在线播放一区在线播放| 深夜福利资源在线观看| 国产AV巨作丝袜秘书| 爱情岛亚洲论坛成人网站| 国产精品国产精品偷麻豆| 国产内射性高湖| 国产一区二区三区色老头| 欧洲一区二区中文字幕| 色悠悠国产精品免费观看| 成人网站免费观看永久视频下载| 美乳丰满人妻无码视频| 久久精品国产九一九九九| 真实国产老熟女无套中出|