iT邦幫忙

2023 iThome 鐵人賽

DAY 11
0
自我挑戰組

基礎學習Flutter系列 第 11

Day11-學習[Building for iOS with Flutter]得出小部件

  • 分享至 

  • xImage
  •  

活動指示器

class HomePage extends Statelesswidget {
  const HomePage () ;

@override
Widget build (BuildContext context) {
  return CupertinoPageScaffold(
    child: Center(
      child: CupertinoActivityIndicator(
        radius: 32,
       ), // CupertinoActivityIndicator
      ), // Center
     ); // CupertinoPageScaffold
    }
   }

在return CupertionPageScaffold的下一行輸入,使用者介面會出現頭頂內容.

navigationBar: CupertinoNavigationBar(
  middle: const Text('Activity Indicator'),
).

https://ithelp.ithome.com.tw/upload/images/20230926/20130175eSs137xxGj.jpg

底部三選組件

class HomePage extends StatelessWidget {
  const HomePage ();

@override
Widget build(BuildContext context) {
  return CupertinoTabScaffold(
    tabBar: CupertinoTabBar(
      items: const <BottomNavigationBarItem> [
        BottomNavigationBarItem(
          icon: Icon (CupertinoIcons. home) ,
          title: Text ('Home'),
          ),
        BottomNavigationBarItem(
          icon: Icon (CupertinoIcons. conversation_bubble),
          title: Text ('Support'),
        BottomNavigationBarItem(
          icon: Icon (CupertinoIcons-profile_circled),
          title: Text('Profile')
          ),
        ],
      ),
      tabBuilder: (BuildContext context, int index) {
        assert (index >= 0 && index <= 2);
        switch (index) {
          case 0:
            return CupertinoTabView(
              builder: (BuildContext context) => buildPage('Home'), 
            );
            break;
          case 1;
            return CupertinoTabView(
              builder: (BuildContext context) => buildPage ('Support'),
            break;
          case 2:
            return CupertinoTabView(
              builder: (BuildContext context) => buildPage('Profile'),
            );
            break;
          }
          return null;
         },
       };
     }
 widget buildPage (String title) {
   return CupertinoPageScaffold(
     navigationBar: CupertinoNavigationBar (
       middle: Text(title),
       ), 
     child: Center
       child: CupertinoActivityindicator(radius:32),
       ),
      );
     }
    }

https://ithelp.ithome.com.tw/upload/images/20230926/20130175juO7pSQBsX.jpg


上一篇
Day10-學習[Building for iOS with Flutter]得出小部件
下一篇
Day12-學習[Building for iOS with Flutter]得出基礎應用程式
系列文
基礎學習Flutter30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言