<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Machir Chen on Medium]]></title>
        <description><![CDATA[Stories by Machir Chen on Medium]]></description>
        <link>https://medium.com/@machir?source=rss-fdfacc3ce8c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vEWTUTQOs9QIeXH8mk6Nnw.jpeg</url>
            <title>Stories by Machir Chen on Medium</title>
            <link>https://medium.com/@machir?source=rss-fdfacc3ce8c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:14:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@machir/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Flutter#3 快艇骰子 (Yahtzee)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/flutter-3-%E5%BF%AB%E8%89%87%E9%AA%B0%E5%AD%90-yahtzee-7a93aaa64d9f?source=rss-fdfacc3ce8c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a93aaa64d9f</guid>
            <dc:creator><![CDATA[Machir Chen]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 06:15:59 GMT</pubDate>
            <atom:updated>2024-08-25T13:30:11.609Z</atom:updated>
            <content:encoded><![CDATA[<p>好玩的快艇骰子✌️✌️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlGpczZzhX_eSr1WdlqM5w.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X3GGE1_We08L9Fq2vwrkRQ.gif" /><figcaption>iOS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*_FNRujpMIJxsuGXXcJ16Gg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*QQsoAagwGZXvkgdxGNGf3g.gif" /><figcaption>Android</figcaption></figure><p><strong>UI</strong></p><ul><li>GridView</li></ul><pre>class ScoreGridView extends StatelessWidget {<br>  final Function(int) onPressed1;<br>  final Function(int) onPressed2;<br><br>  final Yahtzee yahtzee;<br>  final List&lt;String&gt; score1List;<br>  final List&lt;String&gt; score2List;<br>  final List&lt;bool&gt; shouldAllowClickArray1;<br>  final List&lt;bool&gt; shouldAllowClickArray2;<br><br>  const ScoreGridView({<br>    super.key,<br>    required this.onPressed1,<br>    required this.onPressed2,<br>    required this.yahtzee,<br>    required this.score1List,<br>    required this.score2List,<br>    required this.shouldAllowClickArray1,<br>    required this.shouldAllowClickArray2,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Expanded(<br>      child: GridView.builder(<br>        itemCount: yahtzee.titles.length,<br>        gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(<br>          crossAxisCount: 2,<br>          mainAxisSpacing: 1,<br>          crossAxisSpacing: 10,<br>          childAspectRatio: 3.5,<br>        ),<br>        itemBuilder: (context, index) {<br>          return ItemRow(<br>            title: yahtzee.titles[index],<br>            onPressed1: () =&gt; onPressed1(index),<br>            onPressed2: () =&gt; onPressed2(index),<br>            score1: score1List[index],<br>            score2: score2List[index],<br>            shouldAllowClick1: shouldAllowClickArray1[index],<br>            shouldAllowClick2: shouldAllowClickArray2[index],<br>            score1TextColor:<br>                shouldAllowClickArray1[index] ? Colors.lightBlue : Colors.black,<br>            score2TextColor:<br>                shouldAllowClickArray2[index] ? Colors.lightBlue : Colors.black,<br>          );<br>        },<br>      ),<br>    );<br>  }<br>}</pre><p><strong>Models</strong></p><ul><li>Yahtzee</li><li>Player</li></ul><p>1. Yahtzee</p><pre>class Yahtzee {<br>  List&lt;String&gt; images = [<br>    &#39;assets/dice1.png&#39;,<br>    &#39;assets/dice2.png&#39;,<br>    &#39;assets/dice3.png&#39;,<br>    &#39;assets/dice4.png&#39;,<br>    &#39;assets/dice5.png&#39;,<br>  ];<br><br>  List&lt;String&gt; titles = [<br>    &#39;Ones&#39;,<br>    &#39;Three of a kind&#39;,<br>    &#39;Twos&#39;,<br>    &#39;Four of a kind&#39;,<br>    &#39;Threes&#39;,<br>    &#39;Full House&#39;,<br>    &#39;Fours&#39;,<br>    &#39;Small straight&#39;,<br>    &#39;Fives&#39;,<br>    &#39;Large straight&#39;,<br>    &#39;Sixes&#39;,<br>    &#39;Chance&#39;,<br>    &#39;Sum&#39;,<br>    &#39;YAHTZEE&#39;,<br>    &#39;Bonus&#39;,<br>    &#39;TOTAL SCORE&#39;,<br>  ];<br><br>  List&lt;bool&gt; holdDiceState = [<br>    false,<br>    false,<br>    false,<br>    false,<br>    false,<br>  ];<br><br>  int time = 3;<br>  List&lt;int&gt; dice = [1, 2, 3, 4, 5];<br><br>  void resetDiceState() {<br>    for (int i = 0; i &lt; holdDiceState.length; i++) {<br>      holdDiceState[i] = false;<br>    }<br>  }<br><br>  void rollDice() {<br>    for (int i = 0; i &lt; holdDiceState.length; i++) {<br>      if (holdDiceState[i] == false) {<br>        int random = Random().nextInt(6);<br>        int score = random + 1;<br>        dice[i] = score;<br>        images[i] = &#39;assets/dice$score.png&#39;;<br>      }<br>    }<br>  }<br><br>  int? calculateScore(String category, Map&lt;String, String&gt; scores) {<br>    switch (category) {<br>      case &#39;Ones&#39;:<br>        return _sumOfNumbers(dice, 1);<br>      case &#39;Twos&#39;:<br>        return _sumOfNumbers(dice, 2);<br>      case &#39;Threes&#39;:<br>        return _sumOfNumbers(dice, 3);<br>      case &#39;Fours&#39;:<br>        return _sumOfNumbers(dice, 4);<br>      case &#39;Fives&#39;:<br>        return _sumOfNumbers(dice, 5);<br>      case &#39;Sixes&#39;:<br>        return _sumOfNumbers(dice, 6);<br>      case &#39;Three of a kind&#39;:<br>        return _nOfAKind(dice, 3);<br>      case &#39;Four of a kind&#39;:<br>        return _nOfAKind(dice, 4);<br>      case &#39;Full House&#39;:<br>        return _fullHouse(dice);<br>      case &#39;Small straight&#39;:<br>        return _smallStraight(dice);<br>      case &#39;Large straight&#39;:<br>        return _largeStraight(dice);<br>      case &#39;YAHTZEE&#39;:<br>        return _yacht(dice);<br>      case &#39;Chance&#39;:<br>        return dice.reduce((a, b) =&gt; a + b);<br>      case &#39;Sum&#39;:<br>        return _calculateSum(scores);<br>      case &#39;Bonus&#39;:<br>        int? sum = _calculateSum(scores);<br>        if (sum != null &amp;&amp; sum &gt;= 63) {<br>          return 35;<br>        } else {<br>          return null;<br>        }<br>      case &#39;TOTAL SCORE&#39;:<br>        return _calculateTotalScore(scores);<br>      default:<br>        return null;<br>    }<br>  }<br><br>//一些計算分數的方法，ex: _calculateTotalScore(Map&lt;String, String&gt; scores)，_calculateSum(Map&lt;String, String&gt; scores)...<br>  <br>  Yahtzee();<br><br>}<br></pre><p>2. Player</p><pre>class Player {<br>  Map&lt;String, String&gt; scores = {<br>    &#39;Ones&#39;: &#39;&#39;,<br>    &#39;Three of a kind&#39;: &#39;&#39;,<br>    &#39;Twos&#39;: &#39;&#39;,<br>    &#39;Four of a kind&#39;: &#39;&#39;,<br>    &#39;Threes&#39;: &#39;&#39;,<br>    &#39;Full House&#39;: &#39;&#39;,<br>    &#39;Fours&#39;: &#39;&#39;,<br>    &#39;Small straight&#39;: &#39;&#39;,<br>    &#39;Fives&#39;: &#39;&#39;,<br>    &#39;Large straight&#39;: &#39;&#39;,<br>    &#39;Sixes&#39;: &#39;&#39;,<br>    &#39;Chance&#39;: &#39;&#39;,<br>    &#39;Sum&#39;: &#39;&#39;,<br>    &#39;YAHTZEE&#39;: &#39;&#39;,<br>    &#39;Bonus&#39;: &#39;&#39;,<br>    &#39;TOTAL SCORE&#39;: &#39;&#39;,<br>  };<br><br>  late Map&lt;String, String&gt; displayScore = Map.from(scores);<br>  int totalScore = 0;<br>  bool isWinner = false;<br>  String name;<br><br>  Map&lt;String, bool&gt; tapEnable = {<br>    &#39;Ones&#39;: false,<br>    &#39;Three of a kind&#39;: false,<br>    &#39;Twos&#39;: false,<br>    &#39;Four of a kind&#39;: false,<br>    &#39;Threes&#39;: false,<br>    &#39;Full House&#39;: false,<br>    &#39;Fours&#39;: false,<br>    &#39;Small straight&#39;: false,<br>    &#39;Fives&#39;: false,<br>    &#39;Large straight&#39;: false,<br>    &#39;Sixes&#39;: false,<br>    &#39;Chance&#39;: false,<br>    &#39;Sum&#39;: false,<br>    &#39;YAHTZEE&#39;: false,<br>    &#39;Bonus&#39;: false,<br>    &#39;TOTAL SCORE&#39;: false,<br>  };<br><br>  Player({<br>    required this.name,<br>  });<br>}</pre><p><strong>頁面切換</strong></p><ul><li>Navigator</li></ul><p>傳資料到 Result 頁面，在 main.dart 定義 replay 要執行的事情。</p><pre>//main.dart<br><br>Navigator.push(<br>  context,<br>  MaterialPageRoute(<br>    builder: (context) {<br>      return Result(<br>        player1: player1,<br>        player2: player2,<br>        onReplay: replay,<br>      );<br>    },<br>  ),<br>);<br><br><br>void replay() {<br>    setState(() {<br>//數值重設，復原成第一回合該有的樣子<br>    });<br>  }</pre><pre>//result.dart<br><br>class Result extends StatelessWidget {<br>  final Player player1;<br>  final Player player2;<br>  final VoidCallback onReplay;<br><br>  const Result({<br>    super.key,<br>    required this.player1,<br>    required this.player2,<br>    required this.onReplay,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: [<br>            Row(<br>              mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>              children: [<br>                ResultPlayer(player: player1),<br>                ResultPlayer(player: player2),<br>              ],<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.all(50.0),<br>              child: Text(<br>                &#39;${player1.isWinner ? player1.name : player2.name}\nwin the game&#39;,<br>                textAlign: TextAlign.center,<br>                style: const TextStyle(fontSize: 30),<br>              ),<br>            ),<br>            ElevatedButton(<br>                onPressed: () {<br>                  onReplay();<br>                  Navigator.pop(context);<br>                },<br>                child: const Text(&#39;REPLAY&#39;))<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a93aaa64d9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/flutter-3-%E5%BF%AB%E8%89%87%E9%AA%B0%E5%AD%90-yahtzee-7a93aaa64d9f">Flutter#3 快艇骰子 (Yahtzee)</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter#2 模仿 Instagram 製作多頁面電子書]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/flutter-2-%E6%A8%A1%E4%BB%BF-instagram-%E8%A3%BD%E4%BD%9C%E5%A4%9A%E9%A0%81%E9%9D%A2%E9%9B%BB%E5%AD%90%E6%9B%B8-ef8e00df0a5c?source=rss-fdfacc3ce8c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef8e00df0a5c</guid>
            <dc:creator><![CDATA[Machir Chen]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 17:37:27 GMT</pubDate>
            <atom:updated>2024-08-12T08:19:56.752Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*a_VVTEVD-dz9yBpuFDEgXw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*66SNyf0YM2laYKi9qiaswQ.gif" /><figcaption>android(左圖) iOS(右圖)</figcaption></figure><ul><li>ListView.builder</li><li>Navigator</li><li>InkWell</li><li>GridView</li><li>DefaultTabController、TabBar、TabBarView</li><li>Card widget</li></ul><p>main.dart</p><pre>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br><br>  List&lt;Attraction&gt; attractions = await loadAttractions();<br><br>  runApp(MyApp(attractions: attractions));<br>}<br><br>class MyApp extends StatelessWidget {<br>  final List&lt;Attraction&gt; attractions; //List屬性，存放景點資料<br><br>  const MyApp({super.key, required this.attractions});<br><br>  // This widget is the root of your application.<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: MyHomePage(<br>        title: &#39;Tainan&#39;,<br>        attractions: attractions,<br>      ),<br>      debugShowCheckedModeBanner: false,<br>    );<br>  }<br>}<br><br>class MyHomePage extends StatelessWidget {<br>  final String title;<br>  final List&lt;Attraction&gt; attractions; //List屬性，存放景點資料<br><br>  const MyHomePage({super.key, required this.title, required this.attractions});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return DefaultTabController( //使用DefaultTabController<br>      length: 3,<br>      child: Scaffold(<br>        appBar: AppBar(<br>          backgroundColor: Colors.black,<br>          title: Text(<br>            title,<br>            style: TextStyle(color: Colors.white),<br>          ),<br>          bottom: const TabBar( //在Widget AppBar 的 bottom屬性放入TabBar<br>            tabs: [<br>              Tab(<br>                icon: Icon(Icons.grid_on),<br>              ),<br>              Tab(<br>                icon: Icon(Icons.reorder),<br>              ),<br>              Tab(<br>                icon: Icon(Icons.credit_card),<br>              )<br>            ],<br>            labelColor: Colors.white, //將tab的icon設定為白色<br>            unselectedLabelColor: Color.fromRGBO(153, 153, 153, 1), //未選中時的Tab顏色<br>            indicator: UnderlineTabIndicator( //TabBar底部的細線<br>              borderSide: BorderSide(<br>                color: Colors.white,<br>                width: 1.0,<br>              ),<br>            ),<br>            dividerColor: Colors.transparent, //TabBar底部有個螢幕寬的白色線，這邊的做法是將顏色設為transparent，讓這條線不可見<br>          ),<br>          centerTitle: true,<br>          actions: [ //AppBar右方的鈴鐺和...Icon<br>            IconButton(<br>              onPressed: () {},<br>              icon: const Icon(<br>                Icons.notifications_none,<br>                color: Colors.white,<br>              ),<br>            ),<br>            IconButton(<br>              onPressed: () {},<br>              icon: const Icon(<br>                Icons.more_horiz,<br>                color: Colors.white,<br>              ),<br>            ),<br>          ],<br>        ),<br>        backgroundColor: Colors.black,<br>        body: TabBarView( //Scaffold的body放入TabBarView<br>          children: [<br>            ImageGridView(attractions: attractions), //第一個Tab<br>            CustomListView( //第二個Tab<br>              attractions: attractions,<br>              tileBuilder: (attraction) {<br>                return ImageTitleTile(attraction: attraction);<br>              },<br>            ),<br>            CustomListView( //第三個Tab<br>              attractions: attractions,<br>              tileBuilder: (attraction) {<br>                return ImageTitleCardTile(attraction: attraction);<br>              },<br>            )<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>定義Attraction型別</p><pre>class Attraction {<br>  String name;<br>  String image;<br>  String content;<br>  String date;<br>  String address;<br>  String openingHours;<br>  String? fare;<br><br>  Attraction({<br>    required this.name,<br>    required this.image,<br>    required this.content,<br>    required this.date,<br>    required this.address,<br>    required this.openingHours,<br>    this.fare,<br>  });<br><br>  factory Attraction.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return Attraction(<br>      name: json[&#39;景點中文名稱&#39;],<br>      image: json[&#39;照片連結網址1[提供無版權爭議且可對外流通供應之照片，以讓加值業者可透過本網址連結使用]&#39;],<br>      content: json[&#39;景點特色精簡版文字簡述[中文]&#39;],<br>      date: json[&#39;資料變動時間&#39;],<br>      address: json[&#39;景點中文地址，未具地址則填註景點名稱，旅服中心或單位主管機關住址或可資識別之概略地段描述[但座標仍定位在點位置]&#39;],<br>      openingHours: json[&#39;開放時間&#39;],<br>      fare: json[&#39;票價及相關價格資料[選填]&#39;],<br>    );<br>  }<br>}<br><br>Future&lt;List&lt;Attraction&gt;&gt; loadAttractions() async {<br>  try {<br>    String jsonString =<br>        await rootBundle.loadString(&#39;assets/data/TainanAttractions.json&#39;);<br><br>    // 解析 JSON 數據<br>    final Map&lt;String, dynamic&gt; jsonData = jsonDecode(jsonString);<br><br>    // 獲取 &quot;data&quot; List<br>    final List&lt;dynamic&gt; jsonList = jsonData[&#39;data&#39;] ?? [];<br><br>    // 檢查解析结果<br>    if (jsonList.isEmpty) {<br>      print(&quot;Warning: JSON list is empty.&quot;);<br>    }<br><br>    return jsonList.map((item) =&gt; Attraction.fromJson(item)).toList();<br>  } catch (e) {<br>    print(&quot;Error loading JSON: $e&quot;);<br>    return []; // 返回一個空列表而不是null<br>  }<br>}</pre><p>第一個Tab</p><pre>class ImageGridView extends StatelessWidget {<br>  final List&lt;Attraction&gt; attractions; //List屬性，存放景點資料<br><br>  const ImageGridView({<br>    super.key,<br>    required this.attractions,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return GridView.builder(<br>      itemCount: attractions.length, //count = 所有景點<br>      padding: const EdgeInsets.only(top: 1.0),<br>      gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(<br>        crossAxisCount: 3,<br>        mainAxisSpacing: 1, //因為是我是垂直滾動，所以mainAxisSpacing是image和image上下的間距<br>        crossAxisSpacing: 1, //因為是我是垂直滾動，所以crossAxisSpacing是image和image左右的間距<br>      ),<br>      itemBuilder: (context, index) {<br>        return InkWell( //點擊item要跳下一個，使用InkWell讓他可以是點擊item的任何一個地方都會有反應<br>          onTap: () {<br>            Navigator.push( //跳下一頁<br>              context,<br>              MaterialPageRoute(<br>                builder: (context) =&gt;<br>                    AttractionDetail(attraction: attractions[index]), //AttractionDetail是自定義的Widget，用來顯示下一頁的畫面<br>              ),<br>            );<br>          },<br>          child: ImageTile( //ImageTile是自定義的Widget，用來顯是GridView的item的圖片<br>            attraction: attractions[index],<br>          ),<br>        );<br>      },<br>    );<br>  }<br>}</pre><p>ImageTile，用在GridView</p><pre>class ImageTile extends StatelessWidget {<br>  const ImageTile({super.key, required this.attraction});<br><br>  final Attraction attraction;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return CachedNetworkImage(<br>      imageUrl: attraction.image,<br>      fit: BoxFit.cover, // 使圖片覆蓋整個Tile<br>      placeholder: (context, url) =&gt; const Center(<br>        child: CircularProgressIndicator(),<br>      ),<br>      errorWidget: (context, url, error) =&gt; const Icon(Icons.error),<br>    );<br>  }<br>}</pre><p>第二個Tab和第三個Tab，差別在於填入的 tileBuilder 不同</p><pre>class CustomListView extends StatelessWidget {<br>  final List&lt;Attraction&gt; attractions;<br>  final Widget Function(Attraction) tileBuilder;<br><br>  const CustomListView({<br>    super.key,<br>    required this.attractions,<br>    required this.tileBuilder,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return ListView.builder(<br>      itemCount: attractions.length,<br>      itemBuilder: (context, index) {<br>        return InkWell(<br>          onTap: () {<br>            Navigator.push(<br>              context,<br>              MaterialPageRoute(<br>                builder: (context) =&gt;<br>                    AttractionDetail(attraction: attractions[index]),<br>              ),<br>            );<br>          },<br>          child: tileBuilder(attractions[index]),<br>        );<br>      },<br>    );<br>  }<br>}</pre><p>ImageTitleTile 用於第二個 Tab 的 ListView</p><pre>class ImageTitleTile extends StatelessWidget {<br>  const ImageTitleTile({super.key, required this.attraction});<br><br>  final Attraction attraction;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Padding(<br>      padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),<br>      child: Row(<br>        children: [<br>          SizedBox(<br>            width: 60,<br>            height: 60,<br>            child: ClipOval(<br>              child: CachedNetworkImage(<br>                imageUrl: attraction.image,<br>                fit: BoxFit.cover,<br>                placeholder: (context, url) =&gt; const Center(<br>                  child: CircularProgressIndicator(),<br>                ),<br>                errorWidget: (context, url, error) =&gt; const Icon(Icons.error),<br>              ),<br>            ),<br>          ),<br>          const SizedBox(width: 10),<br>          Expanded(<br>            child: Column(<br>              crossAxisAlignment: CrossAxisAlignment.start,<br>              children: [<br>                Text(<br>                  attraction.name,<br>                  style: const TextStyle(<br>                    color: Colors.white,<br>                    fontWeight: FontWeight.bold,<br>                  ),<br>                  overflow: TextOverflow.ellipsis,<br>                ),<br>                Text(<br>                  attraction.address,<br>                  style: const TextStyle(<br>                    color: Color.fromRGBO(153, 153, 153, 1),<br>                  ),<br>                  overflow: TextOverflow.ellipsis,<br>                ),<br>              ],<br>            ),<br>          ),<br>          SizedBox(<br>            height: 30,<br>            child: TextButton(<br>              style: TextButton.styleFrom(<br>                  backgroundColor: const Color.fromRGBO(3, 151, 254, 1),<br>                  foregroundColor: Colors.white,<br>                  padding: const EdgeInsets.symmetric(horizontal: 30),<br>                  shape: RoundedRectangleBorder(<br>                    borderRadius: BorderRadius.circular(8),<br>                  )),<br>              onPressed: () {},<br>              child: const Text(<br>                &#39;Follow&#39;,<br>              ),<br>            ),<br>          )<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><p>ImageTitleCardTile 用於第三個 Tab 的 ListView</p><pre>class ImageTitleCardTile extends StatelessWidget {<br>  const ImageTitleCardTile({super.key, required this.attraction});<br><br>  final Attraction attraction;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Center(<br>      child: Card(<br>        color: Colors.white,<br>        child: Column(<br>          crossAxisAlignment: CrossAxisAlignment.stretch,<br>          children: [<br>            Padding(<br>              padding: const EdgeInsets.all(8.0),<br>              child: Row(<br>                children: [<br>                  SizedBox(<br>                    width: 100,<br>                    height: 100,<br>                    child: ClipRRect(<br>                      borderRadius: BorderRadius.circular(10),<br>                      child: CachedNetworkImage(<br>                        imageUrl: attraction.image,<br>                        fit: BoxFit.cover,<br>                        placeholder: (context, url) =&gt; const Center(<br>                          child: CircularProgressIndicator(),<br>                        ),<br>                        errorWidget: (context, url, error) =&gt;<br>                            const Icon(Icons.error),<br>                      ),<br>                    ),<br>                  ),<br>                  const SizedBox(width: 10),<br>                  Expanded(<br>                    child: Column(<br>                      crossAxisAlignment: CrossAxisAlignment.start,<br>                      children: [<br>                        Text(<br>                          attraction.name,<br>                          style: const TextStyle(<br>                            color: Colors.black,<br>                            fontWeight: FontWeight.bold,<br>                          ),<br>                        ),<br>                        Text(<br>                          &#39;開放時間：${attraction.openingHours}&#39;,<br>                          style: const TextStyle(<br>                            color: Colors.black,<br>                            fontWeight: FontWeight.bold,<br>                          ),<br>                        ),<br>                        Text(<br>                          &#39;收費方式：${attraction.fare}&#39;,<br>                          style: const TextStyle(<br>                            color: Colors.black,<br>                            fontWeight: FontWeight.bold,<br>                          ),<br>                        ),<br>                      ],<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.all(8.0),<br>              child: SizedBox(<br>                width: double.infinity,<br>                child: TextButton(<br>                  style: TextButton.styleFrom(<br>                      backgroundColor: const Color.fromRGBO(3, 151, 254, 1),<br>                      foregroundColor: Colors.white,<br>                      shape: RoundedRectangleBorder(<br>                        borderRadius: BorderRadius.circular(10),<br>                      )),<br>                  onPressed: () {},<br>                  child: const Text(<br>                    &#39;Save&#39;,<br>                  ),<br>                ),<br>              ),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>內頁文章</p><pre>class AttractionDetail extends StatelessWidget {<br>  const AttractionDetail({super.key, required this.attraction});<br>  final Attraction attraction;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    double screenWidth = MediaQuery.of(context).size.width;<br><br>    return Scaffold(<br>      backgroundColor: Colors.black,<br>      appBar: AppBar(<br>        backgroundColor: Colors.black,<br>        iconTheme: const IconThemeData(color: Colors.white),<br>        title: const Text(<br>          &#39;Posts&#39;,<br>          style: TextStyle(color: Colors.white),<br>        ),<br>        centerTitle: true,<br>      ),<br>      body: SingleChildScrollView(<br>        child: Column(<br>          children: [<br>            Row(<br>              children: [<br>                Row(<br>                  children: [<br>                    Padding(<br>                      padding: const EdgeInsets.all(8.0),<br>                      child: SizedBox(<br>                        width: 40,<br>                        height: 40,<br>                        child: ClipOval(<br>                          child: CachedNetworkImage(<br>                            imageUrl: attraction.image,<br>                            fit: BoxFit.cover,<br>                            placeholder: (context, url) =&gt; const Center(<br>                              child: CircularProgressIndicator(),<br>                            ),<br>                            errorWidget: (context, url, error) =&gt;<br>                                const Icon(Icons.error),<br>                          ),<br>                        ),<br>                      ),<br>                    ),<br>                    Text(<br>                      attraction.name,<br>                      style: const TextStyle(<br>                        color: Colors.white,<br>                        fontWeight: FontWeight.bold,<br>                      ),<br>                    )<br>                  ],<br>                ),<br>                const Spacer(), //使用Spacer撐開空間，使另外兩個child靠左和靠右<br>                const Padding(<br>                  padding: EdgeInsets.all(8.0),<br>                  child: Icon(<br>                    Icons.more_horiz,<br>                    color: Colors.white,<br>                  ),<br>                ),<br>              ],<br>            ),<br>            SizedBox(<br>              width: screenWidth,<br>              height: screenWidth,<br>              child: CachedNetworkImage(<br>                imageUrl: attraction.image,<br>                fit: BoxFit.cover,<br>                placeholder: (context, url) =&gt; const Center(<br>                  child: CircularProgressIndicator(),<br>                ),<br>                errorWidget: (context, url, error) =&gt; const Icon(Icons.error),<br>              ),<br>            ),<br>            const Row(<br>              children: [<br>                Row(<br>                  children: [<br>                    Padding(<br>                      padding: EdgeInsets.all(8.0),<br>                      child: Icon(<br>                        Icons.favorite_outline,<br>                        size: 30,<br>                        color: Colors.white,<br>                      ),<br>                    ),<br>                    Padding(<br>                      padding: EdgeInsets.all(8.0),<br>                      child: Icon(<br>                        Icons.mode_comment_outlined,<br>                        size: 30,<br>                        color: Colors.white,<br>                      ),<br>                    ),<br>                    Padding(<br>                      padding: EdgeInsets.all(8.0),<br>                      child: Icon(<br>                        Icons.send_outlined,<br>                        size: 30,<br>                        color: Colors.white,<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>                Spacer(),<br>                Padding(<br>                  padding: EdgeInsets.all(8.0),<br>                  child: Icon(<br>                    Icons.bookmark_outline,<br>                    size: 30,<br>                    color: Colors.white,<br>                  ),<br>                )<br>              ],<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(<br>                left: 8.0,<br>                right: 8.0,<br>              ),<br>              child: RichText(<br>                text: TextSpan(<br>                  children: [<br>                    TextSpan(<br>                      text: &#39;${attraction.name} &#39;,<br>                      style: const TextStyle(<br>                        color: Colors.white,<br>                        fontWeight: FontWeight.bold,<br>                      ),<br>                    ),<br>                    TextSpan(<br>                      text: attraction.content,<br>                      style: const TextStyle(<br>                        color: Colors.white,<br>                        fontWeight: FontWeight.bold,<br>                        fontSize: 16,<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>              ),<br>            ),<br>            Row(<br>              children: [<br>                Padding(<br>                  padding: const EdgeInsets.all(8.0),<br>                  child: Text(<br>                    attraction.date,<br>                    style: const TextStyle(<br>                      color: Color.fromRGBO(153, 153, 153, 1),<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            )<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef8e00df0a5c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/flutter-2-%E6%A8%A1%E4%BB%BF-instagram-%E8%A3%BD%E4%BD%9C%E5%A4%9A%E9%A0%81%E9%9D%A2%E9%9B%BB%E5%AD%90%E6%9B%B8-ef8e00df0a5c">Flutter#2 模仿 Instagram 製作多頁面電子書</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter#1 模仿Spotify畫面]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/flutter-1-%E6%A8%A1%E4%BB%BFspotify%E7%95%AB%E9%9D%A2-7a31267ab857?source=rss-fdfacc3ce8c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a31267ab857</guid>
            <dc:creator><![CDATA[Machir Chen]]></dc:creator>
            <pubDate>Mon, 29 Jul 2024 13:10:31 GMT</pubDate>
            <atom:updated>2024-07-30T02:37:02.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*vn2mBineSBLiZQvyNvev7A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*3jQxw1Cnmb9jPea8PLBgNw.png" /><figcaption>Flutter模仿(左圖GIF) 、iPhone截圖(右圖)</figcaption></figure><h4>AppBar</h4><p>Scaffold 的 appBar 的 title 使用Row來顯示頭像、All（選項）、Music（選項）、Podcasts（選項）。</p><p>將 Widget Text 包在 Widget Container 裡製作圓角效果。</p><pre>appBar: AppBar(<br>  backgroundColor: Colors.black,<br>  titleTextStyle: TextStyle(<br>    fontSize: 16,<br>  ),<br>  title: Row(<br>    children: [<br>      //加入頭像，All，Music，Podcasts<br>    ],<br>  ),<br>),</pre><h4>SingleChildScrollView</h4><p>Scaffold 的 body 使用 Widget SingleChildScrollView。<br>SingleChildScrollView 的 Child 給 Column (垂直排列)</p><pre>body: SingleChildScrollView(<br>  child: Column(<br>    children: [<br>      Padding(<br>        padding: const EdgeInsets.only(left: 8, right: 8),<br>        child: buildRow(&#39;assets/image1.png&#39;, &#39;if only i were...Radio&#39;,<br>            &#39;assets/image2.png&#39;, &#39;Liked Songs&#39;),<br><br>        //其他要顯示的元件...<br>      ),<br>    ],<br>  ),<br>),</pre><h4>自定義 function buildRow()</h4><p>相似的畫面透過 buildRow 方法填入參數來產生。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*1vBqnk_SBx7ItaXuOVPYwA.png" /></figure><pre>Widget buildRow(<br>      String imagePath1, String title1, String imagePath2, String title2) {<br>    return Padding(<br>      padding: const EdgeInsets.only(bottom: 8.0),<br>      child: Row(<br>        children: [<br>          Expanded(<br>            child: buildGridItem(imagePath1, title1),<br>          ),<br>          SizedBox(width: 8.0),<br>          Expanded(<br>            child: buildGridItem(imagePath2, title2),<br>          ),<br>        ],<br>      ),<br>    );<br>  }</pre><h4>自定義 function buildGridItem()</h4><pre>Widget buildGridItem(String imagePath, String title) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        color: Color.fromARGB(255, 41, 41, 41),<br>        borderRadius: BorderRadius.circular(8),<br>      ),<br>      child: Row(<br>        children: [<br>          Padding(<br>            padding: const EdgeInsets.only(right: 8.0),<br>            child: Container(<br>              width: 60,<br>              height: 60,<br>              child: ClipRRect(<br>                borderRadius: BorderRadius.only(<br>                  topLeft: Radius.circular(8),<br>                  bottomLeft: Radius.circular(8),<br>                ),<br>                child: Image.asset(<br>                  imagePath,<br>                  fit: BoxFit.cover,<br>                ),<br>              ),<br>            ),<br>          ),<br>          Expanded(<br>            child: Container(<br>              child: Text(<br>                title,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                ),<br>                maxLines: null,<br>                overflow: TextOverflow.visible,<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br></pre><p>完整Code:</p><pre>void main() {<br>  runApp(const MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  const MyApp({super.key});<br><br>  // This widget is the root of your application.<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Flutter Demo&#39;,<br>      theme: ThemeData(<br>        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),<br>        useMaterial3: true,<br>      ),<br>      home: const MyHomePage(),<br>      debugShowCheckedModeBanner: false,<br>    );<br>  }<br>}<br><br>class MyHomePage extends StatelessWidget {<br>  const MyHomePage({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        backgroundColor: Colors.black,<br>        titleTextStyle: TextStyle(<br>          fontSize: 16,<br>        ),<br>        title: Row(<br>          children: [<br>            Container(<br>              width: 40,<br>              height: 40,<br>              child: ClipOval(<br>                child: Image.asset(<br>                  &#39;assets/image0.png&#39;,<br>                  fit: BoxFit.contain,<br>                ),<br>              ),<br>            ),<br>            SizedBox(<br>              width: 10,<br>            ),<br>            Container(<br>              width: 40,<br>              height: 30,<br>              decoration: BoxDecoration(<br>                color: Color.fromARGB(255, 30, 215, 96),<br>                borderRadius: BorderRadius.circular(15),<br>              ),<br>              child: Center(<br>                child: Text(<br>                  &#39;All&#39;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(<br>                    color: Colors.black,<br>                  ),<br>                ),<br>              ),<br>            ),<br>            SizedBox(<br>              width: 10,<br>            ),<br>            Container(<br>              width: 70,<br>              height: 30,<br>              decoration: BoxDecoration(<br>                color: Color.fromARGB(255, 41, 41, 41),<br>                borderRadius: BorderRadius.circular(15),<br>              ),<br>              child: Center(<br>                child: Text(<br>                  &#39;Music&#39;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(<br>                    color: Colors.white,<br>                  ),<br>                ),<br>              ),<br>            ),<br>            SizedBox(<br>              width: 10,<br>            ),<br>            Container(<br>              width: 100,<br>              height: 30,<br>              decoration: BoxDecoration(<br>                color: Color.fromARGB(255, 41, 41, 41),<br>                borderRadius: BorderRadius.circular(15),<br>              ),<br>              child: Center(<br>                child: Text(<br>                  &#39;Podcasts&#39;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(<br>                    color: Colors.white,<br>                  ),<br>                ),<br>              ),<br>            ),<br>          ],<br>        ),<br>      ),<br>      body: SingleChildScrollView(<br>        child: Column(<br>          children: [<br>            Padding(<br>              padding: const EdgeInsets.only(left: 8, right: 8),<br>              child: buildRow(&#39;assets/image1.png&#39;, &#39;if only i were...Radio&#39;,<br>                  &#39;assets/image2.png&#39;, &#39;Liked Songs&#39;),<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(left: 8, right: 8),<br>              child: buildRow(&#39;assets/image3.png&#39;, &#39;Shadow of the Sun Radio&#39;,<br>                  &#39;assets/image4.png&#39;, &#39;Dena&#39;),<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(left: 8, right: 8),<br>              child: buildRow(&#39;assets/image5.png&#39;, &#39;Release Rader&#39;,<br>                  &#39;assets/image6.png&#39;, &#39;消除壓力&#39;),<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(left: 8, right: 8),<br>              child: buildRow(&#39;assets/image7.png&#39;, &#39;The Hope Worship&#39;,<br>                  &#39;assets/image8.png&#39;, &#39;Breathe Radio&#39;),<br>            ),<br>            SizedBox(<br>              height: 20,<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.all(8.0),<br>              child: Row(<br>                children: [<br>                  Container(<br>                    width: 60,<br>                    height: 60,<br>                    decoration: BoxDecoration(<br>                        shape: BoxShape.circle,<br>                        image: DecorationImage(<br>                          image: AssetImage(&#39;assets/image9.png&#39;),<br>                          fit: BoxFit.cover,<br>                        )),<br>                  ),<br>                  SizedBox(width: 8),<br>                  Column(<br>                    crossAxisAlignment: CrossAxisAlignment.start,<br>                    children: [<br>                      Text(<br>                        &#39;New release from&#39;,<br>                        style: TextStyle(<br>                          color: Color.fromARGB(255, 167, 167, 167),<br>                          fontSize: 16,<br>                        ),<br>                      ),<br>                      Text(<br>                        &#39;Rachel Liang&#39;,<br>                        style: TextStyle(<br>                            color: Colors.white,<br>                            fontSize: 26,<br>                            fontWeight: FontWeight.bold),<br>                      ),<br>                    ],<br>                  )<br>                ],<br>              ),<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.all(8.0),<br>              child: Container(<br>                decoration: BoxDecoration(<br>                  color: Color.fromARGB(255, 41, 41, 41),<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Row(<br>                  children: [<br>                    Container(<br>                      width: 140,<br>                      height: 140,<br>                      child: ClipRRect(<br>                        borderRadius: BorderRadius.only(<br>                          topLeft: Radius.circular(8),<br>                          bottomLeft: Radius.circular(8),<br>                        ),<br>                        child: Image.asset(<br>                          &#39;assets/image10.png&#39;,<br>                          fit: BoxFit.cover,<br>                        ),<br>                      ),<br>                    ),<br>                    Expanded(<br>                      child: Padding(<br>                        padding:<br>                            const EdgeInsets.only(left: 24, right: 8, top: 16),<br>                        child: Column(<br>                          crossAxisAlignment: CrossAxisAlignment.start,<br>                          mainAxisAlignment: MainAxisAlignment.center,<br>                          children: [<br>                            Text(<br>                              &#39;短痛不如長痛&#39;,<br>                              style: TextStyle(<br>                                color: Colors.white,<br>                                fontSize: 16,<br>                                fontWeight: FontWeight.bold,<br>                              ),<br>                              textAlign: TextAlign.start,<br>                            ),<br>                            Text(<br>                              &#39;Single • Rachel Liang&#39;,<br>                              style: TextStyle(<br>                                fontSize: 14,<br>                                color: Color.fromARGB(255, 167, 167, 167),<br>                              ),<br>                              textAlign: TextAlign.start,<br>                            ),<br>                            SizedBox(height: 16),<br>                            Row(<br>                              mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                              children: [<br>                                Container(<br>                                  width: 40,<br>                                  height: 40,<br>                                  child: Image.asset(<br>                                    &#39;assets/plus.png&#39;,<br>                                    fit: BoxFit.contain,<br>                                  ),<br>                                ),<br>                                Container(<br>                                  width: 60,<br>                                  height: 60,<br>                                  child: Image.asset(<br>                                    &#39;assets/play.png&#39;,<br>                                    fit: BoxFit.contain,<br>                                  ),<br>                                ),<br>                              ],<br>                            )<br>                          ],<br>                        ),<br>                      ),<br>                    )<br>                  ],<br>                ),<br>              ),<br>            ),<br>            SizedBox(<br>              height: 20,<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(left: 16),<br>              child: Row(<br>                children: [<br>                  Text(<br>                    &#39;Your top mixes&#39;,<br>                    style: TextStyle(<br>                      color: Colors.white,<br>                      fontSize: 24,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                    textAlign: TextAlign.start,<br>                  ),<br>                ],<br>              ),<br>            ),<br>            SingleChildScrollView(<br>              scrollDirection: Axis.horizontal,<br>              child: Padding(<br>                padding: const EdgeInsets.all(16.0),<br>                child: Row(<br>                  crossAxisAlignment: CrossAxisAlignment.start,<br>                  children: [<br>                    buildColumn(<br>                      &#39;assets/image11.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image12.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image13.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image14.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image15.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image11.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image12.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      140,<br>                    ),<br>                  ],<br>                ),<br>              ),<br>            ),<br>            SizedBox(<br>              height: 20,<br>            ),<br>            Padding(<br>              padding: const EdgeInsets.only(left: 16),<br>              child: Row(<br>                children: [<br>                  Text(<br>                    &#39;Recently played&#39;,<br>                    style: TextStyle(<br>                      color: Colors.white,<br>                      fontSize: 24,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                    textAlign: TextAlign.start,<br>                  ),<br>                ],<br>              ),<br>            ),<br>            SingleChildScrollView(<br>              scrollDirection: Axis.horizontal,<br>              child: Padding(<br>                padding: const EdgeInsets.all(16.0),<br>                child: Row(<br>                  crossAxisAlignment: CrossAxisAlignment.start,<br>                  children: [<br>                    buildColumn(<br>                      &#39;assets/image16.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image17.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image18.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image19.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image20.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image21.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                    SizedBox(<br>                      width: 16,<br>                    ),<br>                    buildColumn(<br>                      &#39;assets/image16.png&#39;,<br>                      &#39;SPOTIFYYYYYYYYYYYYYY&#39;,<br>                      100,<br>                    ),<br>                  ],<br>                ),<br>              ),<br>            )<br>          ],<br>        ),<br>      ),<br>      backgroundColor: Colors.black,<br>    );<br>  }<br><br>  Widget buildRow(<br>      String imagePath1, String title1, String imagePath2, String title2) {<br>    return Padding(<br>      padding: const EdgeInsets.only(bottom: 8.0),<br>      child: Row(<br>        children: [<br>          Expanded(<br>            child: buildGridItem(imagePath1, title1),<br>          ),<br>          SizedBox(width: 8.0),<br>          Expanded(<br>            child: buildGridItem(imagePath2, title2),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget buildGridItem(String imagePath, String title) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        color: Color.fromARGB(255, 41, 41, 41),<br>        borderRadius: BorderRadius.circular(8),<br>      ),<br>      child: Row(<br>        children: [<br>          Padding(<br>            padding: const EdgeInsets.only(right: 8.0),<br>            child: Container(<br>              width: 60,<br>              height: 60,<br>              child: ClipRRect(<br>                borderRadius: BorderRadius.only(<br>                  topLeft: Radius.circular(8),<br>                  bottomLeft: Radius.circular(8),<br>                ),<br>                child: Image.asset(<br>                  imagePath,<br>                  fit: BoxFit.cover,<br>                ),<br>              ),<br>            ),<br>          ),<br>          Expanded(<br>            child: Container(<br>              child: Text(<br>                title,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                ),<br>                maxLines: null,<br>                overflow: TextOverflow.visible,<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget buildColumn(String imagePath1, String title1, double size) {<br>    return Column(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        Container(<br>          height: size,<br>          width: size,<br>          child: Image.asset(<br>            imagePath1,<br>            fit: BoxFit.contain,<br>          ),<br>        ),<br>        SizedBox(<br>          height: 10,<br>        ),<br>        Container(<br>          width: size,<br>          child: Text(<br>            title1,<br>            style: TextStyle(<br>              color: Color.fromARGB(255, 167, 167, 167),<br>            ),<br>            maxLines: null,<br>          ),<br>        )<br>      ],<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a31267ab857" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/flutter-1-%E6%A8%A1%E4%BB%BFspotify%E7%95%AB%E9%9D%A2-7a31267ab857">Flutter#1 模仿Spotify畫面</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>