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

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

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

      最新版Flutter3.32+Dart3.8跨平臺仿微信app聊天界面|朋友圈

      2025原創研發flutter3+dart3實戰仿微信App聊天系統Flutter3Chat

      flutter3_wechat:基于最新跨平臺框架flutter3.32+dart3.8+get_storage+photo_view從0-1打造仿微信app聊天項目。包含聊天、通訊錄、我的及朋友圈等模塊。實現發送文字+emo表情消息、長按仿微信語音操作、圖片/鏈接預覽等功能。

      最新研發flutter3.27+bitsdojo_window+getx客戶端仿微信聊天Exe應用

      Flutter3-MacOS桌面OS系統|flutter3.32+window_manager客戶端OS模板

      技術棧

      • 編輯器:VScode
      • 框架技術:Flutter3.32+Dart3.8
      • 組件庫:material-design3
      • 彈窗組件:showDialog/SimpleDialog/showModalBottomSheet/AlertDialog
      • 圖片預覽:photo_view^0.15.0
      • 存儲組件:get_storage^2.1.1
      • 下拉刷新:easy_refresh^3.4.0
      • toast提示:toast^0.3.0
      • 網址預覽組件:url_launcher^6.3.1

      項目框架目錄

      flutter3-chat聊天app項目已經更新到我的原創作品集。

      flutter3.32+dart3.8仿微信App聊天界面|朋友圈

      flutter3沉浸式漸變導航條

      通過配置AppBar提供的可伸縮靈活區域屬性 flexibleSpace 搭配gradient即可快速實現漸變導航欄。

      AppBar(
        title: Text('Flutter3-Chat'),
        flexibleSpace: Container(
          decoration: const BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
              colors: [
                Color(0xFF0091EA), Color(0xFF07C160)
              ],
            )
          ),
        )
      ),

      flutter3仿微信PopupMenu下拉菜單/下拉刷新

      flutter提供的PopupMenuButton組件實現下拉菜單功能。

      PopupMenuButton(
        icon: FStyle.iconfont(0xe62d, size: 17.0),
        offset: const Offset(0, 50.0),
        tooltip: '',
        color: const Color(0xFF353535),
        itemBuilder: (BuildContext context) {
          return <PopupMenuItem>[
            popupMenuItem(0xe666, '發起群聊', 0),
            popupMenuItem(0xe75c, '添加朋友', 1),
            popupMenuItem(0xe603, '掃一掃', 2),
            popupMenuItem(0xe6ab, '收付款', 3),
          ];
        },
        onSelected: (value) {
          switch(value) {
            case 0:
              print('發起群聊');
              break;
            case 1:
              Navigator.pushNamed(context, '/addfriends');
              break;
            case 2:
              print('掃一掃');
              break;
            case 3:
              print('收付款');
              break;
          }
        },
      )

      下拉刷新、上拉加載更多是通過 easy_refresh 組件實現功能。

      EasyRefresh(
        // 下拉加載提示
        header: const ClassicHeader(
          // showMessage: false,
        ),
        // 加載更多提示
        footer: ClassicFooter(),
        // 下拉刷新邏輯
        onRefresh: () async {
          // ...下拉邏輯
          await Future.delayed(const Duration(seconds: 2));
        },
        // 上拉加載邏輯
        onLoad: () async {
          // ...
        },
        child: ListView.builder(
          itemCount: chatList.length,
          itemBuilder: (context, index) {
            return Ink(
              // ...
            );
          },
        ),
      )

      彈窗功能均是自定義AlertDialog實現效果。通過無限制容器UnconstrainedBox配合SizedBox組件實現自定義窗口大小。

      // 關于彈窗
      void aboutAlertDialog(BuildContext context) {
        showDialog(
          context: context,
          builder: (context) {
            return UnconstrainedBox(
              constrainedAxis: Axis.vertical,
              child: SizedBox(
                width: 320.0,
                child: AlertDialog(
                  contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
                  backgroundColor: Colors.white,
                  surfaceTintColor: Colors.white,
                  shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
                  content: Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 10.0),
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Image.asset('assets/images/logo.png', width: 90.0, height: 90.0, fit: BoxFit.cover,),
                        const SizedBox(height: 10.0),
                        const Text('Flutter3-WChat', style: TextStyle(color: Color(0xFF0091EA), fontSize: 22.0),),
                        const SizedBox(height: 5.0),
                        const Text('基于flutter3+dart3開發跨平臺仿微信App聊天實例。', style: TextStyle(color: Colors.black45),),
                        const SizedBox(height: 20.0),
                        Text('?2024/01 Andy   Q: 282310962', style: TextStyle(color: Colors.grey[400], fontSize: 12.0),),
                      ],
                    ),
                  ),
                ),
              ),
            );
          }
        );
      }
      
      // 二維碼名片彈窗
      void qrcodeAlertDialog(BuildContext context) {
        showDialog(
          context: context,
          builder: (context) {
            return UnconstrainedBox(
              constrainedAxis: Axis.vertical,
              child: SizedBox(
                width: 320.0,
                child: AlertDialog(
                  contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
                  backgroundColor: const Color(0xFF07C160),
                  surfaceTintColor: const Color(0xFF07C160),
                  shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(3.0)),
                  content: Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 10.0),
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Image.asset('assets/images/qrcode.png', width: 250.0, fit: BoxFit.cover,),
                        const SizedBox(height: 15.0),
                        const Text('掃一掃,加我公眾號', style: TextStyle(color: Colors.white60, fontSize: 14.0,),),
                      ],
                    ),
                  ),
                ),
              ),
            );
          }
        );
      }
      
      // 退出登錄彈窗
      void logoutAlertDialog(BuildContext context) {
        showDialog(
          context: context,
          builder: (context) {
            return AlertDialog(
              content: const Text('確定要退出登錄嗎?', style: TextStyle(fontSize: 16.0),),
              backgroundColor: Colors.white,
              surfaceTintColor: Colors.white,
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
              elevation: 2.0,
              actionsPadding: const EdgeInsets.all(15.0),
              actions: [
                TextButton(
                  onPressed: () {Navigator.of(context).pop();},
                  child: const Text('取消', style: TextStyle(color: Colors.black54),)
                ),
                TextButton(
                  onPressed: handleLogout,
                  child: const Text('退出登錄', style: TextStyle(color: Colors.red),)
                ),
              ],
            );
          }
        );
      }

      flutter3實現微信朋友圈

      ImageGroup(images: item['images'])
      
      ImageGroup(
        images: uploadList,
        album: true,
        onChoose: () async {
          Toast.show('選擇手機相冊圖片', duration: 2, gravity: 1);
        },
      )

      /// 微信朋友圈九宮格圖片
      library;
      
      import 'package:flutter/material.dart';
      import '../router/fade_route.dart';
      import 'image_viewer.dart';
      
      import '../utils/index.dart';
      
      class ImageGroup extends StatelessWidget {
        const ImageGroup({
          super.key,
          this.images,
          this.width = 200.0,
          this.album = false,
          this.limit = 9,
          this.onChoose,
        });
      
        final List<String>? images; // 圖片組
        final double width; // 圖片寬度
        final bool album; // 是否相冊/專輯(最后面顯示+可選擇圖片)
        final int limit; // 限制多少張
        final Function? onChoose; // 選擇圖片回調
      
        int? get count => images?.length;
        List<String>? get imgList => count! >= limit ? images?.sublist(0, limit) : images;
      
        // 創建可點擊預覽圖片
        createImage(BuildContext context, String img, int key) {
          return GestureDetector(
            child: Hero(
              tag: 'image_${key}_$img', // 放大縮小動畫效果標識
              child: img == '+' ? 
              Container(color: Colors.transparent, child: const Icon(Icons.add, size: 30.0, color: Colors.black45),)
              :
              Utils.isUrl(img) ?
              Image.network(
                img,
                width: width,
                fit: BoxFit.contain,
              )
              :
              Image.asset(
                img,
                width: width,
                fit: BoxFit.contain,
              ),
            ),
            onTap: () {
              // 選擇圖片
              if(img == '+') {
                onChoose!();
              }else {
                Navigator.of(context).push(FadeRoute(route: ImageViewer(
                  images: album ? imgList!.sublist(0, imgList!.length - 1) : imgList,
                  index: key,
                  heroTags: imgList!.asMap().entries.map((e) => 'image_${e.key}_${e.value}').toList(),
                )));
              }
            },
          );
        }
      
        @override
        Widget build(BuildContext context){
          // 一張圖片
          if(count == 1 && !album) {
            return SizedBox(
              width: width,
              child: createImage(context, imgList![0], 0),
            );
          }
      
          if(album && count! < limit) {
            imgList?.add('+');
          }
          
          // 多張圖片
          return GridView(
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
            gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
              // 橫軸元素個數
              crossAxisCount: 3,
              // 縱軸間距
              mainAxisSpacing: 5.0,
              // 橫軸間距
              crossAxisSpacing: 5.0,
              // 子組件寬高比例
              childAspectRatio: 1,
            ),
            children: imgList!.asMap().entries.map((e) {
              return Container(
                color: Colors.grey[100],
                child: createImage(context, e.value, e.key),
              );
            }).toList(),
          );
        }
      }

      flutter3聊天功能

      文本框TextField設置maxLines: null即可實現多行文本輸入,支持圖文emoj混排,網址連接識別等功能。

      // 輸入框
      Offstage(
        offstage: voiceBtnEnable,
        child: ConstrainedBox(
          constraints: BoxConstraints(maxHeight: 300.0),
          child: TextField(
            decoration: InputDecoration(
              isDense: true,
              hoverColor: Colors.transparent,
              border: OutlineInputBorder(borderSide: BorderSide.none),
              contentPadding: EdgeInsets.fromLTRB(10, 0, 10, 0)
            ),
            style: const TextStyle(fontSize: 16.0,),
            maxLines: null,
            controller: editorController,
            focusNode: editorFocusNode,
            cursorColor: const Color(0xFF07C160),
            onChanged: (value) {},
          ),
        ),
      )

      // 語音
      Offstage(
        offstage: !voiceBtnEnable,
        child: GestureDetector(
          child: Container(
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(5),
            ),
            alignment: Alignment.center,
            height: 40.0,
            width: double.infinity,
            child: Text(voiceTypeMap[voiceType], style: const TextStyle(fontSize: 15.0),),
          ),
          onPanStart: (details) {
            setState(() {
              voiceType = 1;
              voicePanelEnable = true;
            });
          },
          onPanUpdate: (details) {
            Offset pos = details.globalPosition;
            double swipeY = MediaQuery.of(context).size.height - 120;
            double swipeX = MediaQuery.of(context).size.width / 2 + 50;
            setState(() {
              if(pos.dy >= swipeY) {
                voiceType = 1; // 松開發送
              }else if (pos.dy < swipeY && pos.dx < swipeX) {
                voiceType = 2; // 左滑松開取消
              }else if (pos.dy < swipeY && pos.dx >= swipeX) {
                voiceType = 3; // 右滑語音轉文字
              }
            });
          },
          onPanEnd: (details) {
            // print('停止錄音');
            setState(() {
              switch(voiceType) {
                case 1:
                  Toast.show('發送錄音文件', duration: 1, gravity: 1);
                  voicePanelEnable = false;
                  break;
                case 2:
                  Toast.show('取消發送', duration: 1, gravity: 1);
                  voicePanelEnable = false;
                  break;
                case 3:
                  Toast.show('語音轉文字', duration: 1, gravity: 1);
                  voicePanelEnable = true;
                  voiceToTransfer = true;
                  break;
              }
              voiceType = 0;
            });
          },
        ),
      )

      flutter3繪制聊天箭頭

      // 繪制聊天箭頭
      class ArrowShape extends CustomPainter {
        ArrowShape({
          required this.arrowColor,
          this.arrowSize = 7,
        });
      
        final Color arrowColor; // 箭頭顏色
        final double arrowSize; // 箭頭大小
      
        @override
        void paint(Canvas canvas, Size size) {
          var paint = Paint()..color = arrowColor;
      
          var path = Path();
          path.lineTo(-arrowSize, 0);
          path.lineTo(0, arrowSize);
          path.lineTo(arrowSize, 0);
          canvas.drawPath(path, paint);
        }
      
        @override
        bool shouldRepaint(CustomPainter oldDelegate) {
          return false;
        }
      }

      綜上就是Flutter3+Dart3實戰仿微信App聊天項目的一些知識分享,感謝大家的閱讀與支持!

      Flutter3-MacOS桌面OS系統|flutter3.32+window_manager客戶端OS模板

      附上幾個最新項目實例

      最新研發flutter3.27+bitsdojo_window+getx客戶端仿微信聊天Exe應用

      最新版uni-app+vue3+uv-ui跨三端仿微信app聊天應用【h5+小程序+app端】

      最新版uniapp+vue3+uv-ui跨三端短視頻+直播+聊天【H5+小程序+App端】

      Uniapp-DeepSeek跨三端AI助手|uniapp+vue3+deepseek-v3流式ai聊天模板

      Electron35-DeepSeek桌面端AI系統|vue3.5+electron+arco客戶端ai模板

      vue3-webseek網頁版AI問答|Vite6+DeepSeek+Arco流式ai聊天打字效果

      flutter3-dymall仿抖音直播商城|Flutter3.27短視頻+直播+聊天App實例

      tauri2.0-admin桌面端后臺系統|Tauri2+Vite5+ElementPlus管理后臺EXE程序

      Tauri2.0+Vite5聊天室|vue3+tauri2+element-plus仿微信|tauri聊天應用

      Electron32-ViteOS桌面版os系統|vue3+electron+arco客戶端OS管理模板

      uniapp+vue3聊天室|uni-app+vite4+uv-ui跨端仿微信app聊天語音/朋友圈

       

      posted @ 2025-07-11 08:15  xiaoyan2017  閱讀(295)  評論(0)    收藏  舉報
      友情鏈接: UP主小店B站
      主站蜘蛛池模板: 丰满岳乱妇久久久| 日韩精品无码一区二区三区视频| 在线精品自拍亚洲第一区| 999久久久免费精品播放| 宜州市| 起碰免费公开97在线视频| 亚洲国产区男人本色vr| 风韵丰满熟妇啪啪区老熟熟女| 亚洲一区中文字幕人妻| 免费无遮挡毛片中文字幕| 成年女人碰碰碰视频播放| 美女裸体十八禁免费网站| 自拍偷自拍亚洲一区二区| 亚州中文字幕一区二区| 国产免费毛卡片| 人人妻人人做人人爽夜欢视频| 文中字幕一区二区三区视频播放| 久久精品国产99精品亚洲| 日韩人妻无码一区二区三区99| 日韩有码av中文字幕| 国产美女久久久亚洲综合| 人妻无码ΑV中文字幕久久琪琪布 国产乱人伦AV在线麻豆A | 人妻少妇精品专区性色av| 国产熟女真实乱精品51| 国产毛片三区二区一区| 野外做受三级视频| 日韩一区二区三区在线观院| 午夜福利日本一区二区无码| 久热这里有精品免费视频| 藁城市| 日韩视频中文字幕精品偷拍| 中国帅小伙gaysextubevideo| 国产精品成人一区二区不卡| 欧美老熟妇乱子伦牲交视频| 国产精品中文字幕日韩| 无码人妻一区二区三区线| 视频二区国产精品职场同事 | 亚洲 日本 欧洲 欧美 视频| 久久婷婷五月综合色丁香花| 国产精品 自在自线| 国产成人精品亚洲资源|