diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a9a1303..e186b49 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,14 @@ + + + + + + + + + + createState() => _ChatMessageState(); +} + +class _ChatMessageState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(bottom: 30.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + widget.avatar, + width: 62.w, + height: 62.w, + ), + SizedBox(width: 15.w,), + Flexible( + fit: FlexFit.loose, + child:Container( + margin: EdgeInsets.only(top: 10.w), + padding: EdgeInsets.only( + top: 31.w, + left: 46.w, + bottom: 31.w, + right: 39.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(18.w), + bottomRight: Radius.circular(18.w), + bottomLeft: Radius.circular(18.w), + ), + color: Colors.white + ), + child: Text( + widget.message, + style: TextStyle( + fontSize: 31.w, + color: const Color.fromRGBO(51, 51, 51, 1), + ), + ), + ) + ), + SizedBox(width: 15.w,), + SizedBox( + width: 62.w, + height: 62.w, + ) + ], + ), + ); + } +} diff --git a/lib/components/my_message.dart b/lib/components/my_message.dart new file mode 100644 index 0000000..6d6c9fd --- /dev/null +++ b/lib/components/my_message.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class MyMessage extends StatefulWidget { + final String avatar; + final String message; + const MyMessage({super.key, required this.avatar, required this.message}); + + @override + State createState() => _MyMessageState(); +} + +class _MyMessageState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(bottom: 30.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SizedBox( + width: 62.w, + height: 62.w, + ), + SizedBox(width: 15.w,), + Flexible( + fit: FlexFit.loose, + child:Container( + margin: EdgeInsets.only(top: 10.w), + padding: EdgeInsets.only( + top: 31.w, + left: 46.w, + bottom: 31.w, + right: 39.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(18.w), + bottomRight: Radius.circular(18.w), + bottomLeft: Radius.circular(18.w), + ), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Text( + widget.message, + style: TextStyle( + fontSize: 31.w, + color: Colors.white, + ), + ), + ) + ), + SizedBox(width: 15.w,), + Image.asset( + widget.avatar, + width: 62.w, + height: 62.w, + ), + ], + ), + ); + } +} diff --git a/lib/components/page_appbar.dart b/lib/components/page_appbar.dart index 7fb4f95..0461e10 100644 --- a/lib/components/page_appbar.dart +++ b/lib/components/page_appbar.dart @@ -7,7 +7,8 @@ class PageAppbar extends StatelessWidget implements PreferredSizeWidget { final Color? color; final String title; - const PageAppbar({super.key, required this.title, this.backgroundColor, this.color}); + final Widget? right; + const PageAppbar({super.key, required this.title, this.backgroundColor, this.color, this.right}); @override Widget build(BuildContext context) { @@ -16,6 +17,7 @@ class PageAppbar extends StatelessWidget implements PreferredSizeWidget { surfaceTintColor: backgroundColor ?? const Color.fromRGBO(255, 255, 255, 1), centerTitle: true, foregroundColor: color, + actions: right != null ? [right ?? Container()] : null, title: Text( title, style: TextStyle( diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart index 9cbf7b4..421c6fd 100644 --- a/lib/pages/chat_page.dart +++ b/lib/pages/chat_page.dart @@ -1,6 +1,8 @@ import 'package:dating_touchme_app/components/home_appbar.dart'; +import 'package:dating_touchme_app/router/route_paths.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:go_router/go_router.dart'; class ChatPage extends StatefulWidget { const ChatPage({super.key}); @@ -15,11 +17,11 @@ class _ChatPageState extends State { List topNav = ["聊天", "好友"]; List chatList = [ - {"avatar": "assets/system_notifi.png", "isOnline": false, "userName": "系统通知", "messageNum": 2, "lastMessage": "在干嘛"}, - {"avatar": "assets/user_avatar.png", "isOnline": true, "userName": "林园园", "messageNum": 2, "lastMessage": "在干嘛"}, - {"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李晖", "messageNum": 0, "lastMessage": "好的"}, - {"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李哲", "messageNum": 0, "lastMessage": "在干嘛"}, - {"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李夏", "messageNum": 0, "lastMessage": "在干嘛"}, + {"id": 0,"avatar": "assets/system_notifi.png", "isOnline": false, "userName": "系统通知", "messageNum": 2, "lastMessage": "在干嘛"}, + {"id": 1,"avatar": "assets/user_avatar.png", "isOnline": true, "userName": "林园园", "messageNum": 2, "lastMessage": "在干嘛"}, + {"id": 1,"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李晖", "messageNum": 0, "lastMessage": "好的"}, + {"id": 1,"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李哲", "messageNum": 0, "lastMessage": "在干嘛"}, + {"id": 1,"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李夏", "messageNum": 0, "lastMessage": "在干嘛"}, ]; List topList = [ @@ -37,8 +39,18 @@ class _ChatPageState extends State { {"isFriend": false}, ]; + int nowActive = 0; + + List friendNavList = ["我的关注", "好友", "粉丝"]; + + int friendNavActive = 0; + void changeNav(int active) { print("当前项: $active"); + nowActive = active; + setState(() { + + }); } @override @@ -71,35 +83,120 @@ class _ChatPageState extends State { ), ),), ), - Container( - width: 750.w, - padding: EdgeInsets.only( - top: 5.w, - bottom: 46.w + if(nowActive == 0) ... [ + Container( + width: 750.w, + padding: EdgeInsets.only( + top: 5.w, + bottom: 46.w + ), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(width: 11.w,), + ...topList.map((e){ + return TopItem(item: e); + }), + ], + ), + ), ), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, + Container( + padding: EdgeInsets.symmetric(horizontal: 31.w), + child: Column( + children: [ + ...chatList.map((e){ + return ChatItem(item: e); + }), + ], + ), + ) + ], + if(nowActive == 1) ...[ + Container( + padding: EdgeInsets.symmetric(horizontal: 25.w), + margin: EdgeInsets.only(bottom: 35.w), child: Row( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(width: 11.w,), - ...topList.map((e){ - return TopItem(item: e); + ...friendNavList.asMap().entries.map((entry){ + return Container( + margin: EdgeInsets.only(right: 50.w), + child: InkWell( + onTap: (){ + friendNavActive = entry.key; + setState(() { + + }); + }, + child: Container( + padding: entry.key == friendNavActive ? EdgeInsets.symmetric(vertical: 5.w, horizontal: 26.w) : EdgeInsets.zero, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(43.w)), + color: entry.key == friendNavActive ? const Color.fromRGBO(117, 98, 249, 1) : Colors.transparent + ), + child: Text( + entry.value, + style: TextStyle( + fontSize: 24.w, + color: entry.key == friendNavActive ? Colors.white : const Color.fromRGBO(51, 51, 51, .7), + fontWeight: entry.key == friendNavActive ? FontWeight.w700 : FontWeight.w500 + ), + ), + ), + ), + ); }), + ], ), ), - ), - Container( - padding: EdgeInsets.symmetric(horizontal: 31.w), - child: Column( + if(friendNavActive == 0) ...[ + FriendItem(), + FriendItem(), + FriendItem(), + FriendItem(), + ], + if(friendNavActive != 0) Column( children: [ - ...chatList.map((e){ - return ChatItem(item: e); - }), + SizedBox(height: 100.w,), + Image.asset( + "assets/no_chat_bg.png", + width: 182.w, + height: 182.w, + ), + SizedBox(height: 27..w,), + Text( + "你还没有关注任何人噢", + style: TextStyle( + fontSize: 25.w, + color: const Color.fromRGBO(144, 144, 144, 1), + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: 22..w,), + Container( + width: 302.w, + height: 65.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(65.w)), + color: const Color.fromRGBO(117, 98, 249, 1), + ), + child: Center( + child: Text( + "去聊聊", + style: TextStyle( + fontSize: 25.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ) ], - ), - ) + ) + ] ], ), ); @@ -118,93 +215,104 @@ class _ChatItemState extends State { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.symmetric(vertical: 15.w), margin: EdgeInsets.only(bottom: 15.w), - child: Row( - children: [ - Stack( + child: InkWell( + onTap: (){ + if(widget.item["id"] == 0){ + context.pushNamed(RouteNames.notify); + } else { + context.pushNamed(RouteNames.message); + } + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 15.w), + child: Row( children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(92.w)), - child: Image.asset( - widget.item["avatar"], - width: 92.w, - height: 92.w, - ), - ), - if(widget.item["isOnline"]) Positioned( - right: 0, - bottom: 0, - child: Container( - width: 22.w, - height: 22.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(22.w)), - color: const Color.fromRGBO(43, 255, 132, 1) + Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(92.w)), + child: Image.asset( + widget.item["avatar"], + width: 92.w, + height: 92.w, + ), ), - ), - ), - ], - ), - SizedBox(width: 17.w,), - SizedBox( - width: 578.w, - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - widget.item["userName"], - style: TextStyle( - fontSize: 27.w, - color: const Color.fromRGBO(51, 51, 51, 1), - fontWeight: FontWeight.w500 + if(widget.item["isOnline"]) Positioned( + right: 0, + bottom: 0, + child: Container( + width: 22.w, + height: 22.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(22.w)), + color: const Color.fromRGBO(43, 255, 132, 1) ), ), - Text( - "19.24", - style: TextStyle( - fontSize: 23.w, - color: const Color.fromRGBO(51, 51, 51, .6), - ), - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ), + ], + ), + SizedBox(width: 17.w,), + SizedBox( + width: 578.w, + child: Column( children: [ - Text( - widget.item["lastMessage"], - style: TextStyle( - fontSize: 23.w, - color: const Color.fromRGBO(51, 51, 51, .6), - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.item["userName"], + style: TextStyle( + fontSize: 27.w, + color: const Color.fromRGBO(51, 51, 51, 1), + fontWeight: FontWeight.w500 + ), + ), + Text( + "19.24", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, .6), + ), + ) + ], ), - if(widget.item["messageNum"] > 0) Container( - width: 38.w, - height: 38.w, - margin: EdgeInsets.only(right: 9.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(38.w)), - color: const Color.fromRGBO(255, 87, 51, 1) - ), - child: Center( - child: Text( - "${widget.item["messageNum"]}", + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.item["lastMessage"], style: TextStyle( fontSize: 23.w, - color: Colors.white + color: const Color.fromRGBO(51, 51, 51, .6), ), ), - ), + if(widget.item["messageNum"] > 0) Container( + width: 38.w, + height: 38.w, + margin: EdgeInsets.only(right: 9.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(38.w)), + color: const Color.fromRGBO(255, 87, 51, 1) + ), + child: Center( + child: Text( + "${widget.item["messageNum"]}", + style: TextStyle( + fontSize: 23.w, + color: Colors.white + ), + ), + ), + ) + ], ) ], - ) - ], - ), - ) - ], + ), + ) + ], + ), + ), ), ); } @@ -312,5 +420,94 @@ class _TopItemState extends State { } } +class FriendItem extends StatefulWidget { + const FriendItem({super.key}); + + @override + State createState() => _FriendItemState(); +} + +class _FriendItemState extends State { + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 25.w), + margin: EdgeInsets.only(bottom: 30.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/user_avatar.png", + width: 90.w, + height: 90.w, + ), + SizedBox(width: 18.w,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + "叫我大王", + style: TextStyle( + fontSize: 28.w, + color: const Color.fromRGBO(51, 51, 51, 1), + fontWeight: FontWeight.w500 + ), + ), + SizedBox(width: 14.w,), + Container( + width: 24.w, + height: 24.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(24.w)), + color: true ? const Color.fromRGBO(237, 245, 255, 1) : const Color.fromRGBO(255, 237, 255, 1) + ), + child: Center( + child: Image.asset( + true ? "assets/male.png" : "assets/female.png", + width: 14.w, + ), + ), + ) + ], + ), + Text( + "30岁·广州", + style: TextStyle( + fontSize: 22.w, + color: const Color.fromRGBO(144, 144, 144, 1), + fontWeight: FontWeight.w500 + ), + ) + ], + ) + ], + ), + Container( + width: 129.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + color: const Color.fromRGBO(224, 224, 224, 1) + ), + child: Center( + child: Text( + "已关注", + style: TextStyle( + fontSize: 22.w, + color: const Color.fromRGBO(144, 144, 144, 1), + fontWeight: FontWeight.w500 + ), + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/pages/message_page.dart b/lib/pages/message_page.dart new file mode 100644 index 0000000..b0a58e0 --- /dev/null +++ b/lib/pages/message_page.dart @@ -0,0 +1,1049 @@ +import 'dart:io'; + +import 'package:dating_touchme_app/components/chat_message.dart'; +import 'package:dating_touchme_app/components/my_message.dart'; +import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/utils/utils.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import 'package:flutter/foundation.dart' as foundation; +import 'package:permission_handler/permission_handler.dart'; +import 'package:tdesign_flutter/tdesign_flutter.dart'; +import 'package:image_picker/image_picker.dart'; + +class MessagePage extends StatefulWidget { + final int id; + const MessagePage({super.key, required this.id}); + + @override + State createState() => _MessagePageState(); +} + +class _MessagePageState extends State with TickerProviderStateMixin { + + + String message = ''; + final TextEditingController _messageController = TextEditingController(); + + + + final _controller = TextEditingController(); + final _scrollController = ScrollController(); + + + final ScrollController _messageScrollController = ScrollController(); + + + + int activeGift = 0; + + List giftList = [ + {"icon": "assets/gift1.png", "title": "爱心礼物", "price": 30}, + {"icon": "assets/gift2.png", "title": "小小小星星", "price": 30}, + {"icon": "assets/gift3.png", "title": "助威", "price": 30}, + {"icon": "assets/gift4.png", "title": "点赞", "price": 30}, + {"icon": "assets/gift5.png", "title": "崇拜衣柜", "price": 30}, + ]; + + int giftNum = 1; + + + + changeActive(int index){ + activeGift = index; + setState(() { + + }); + } + + + late AnimationController _voiceController; + late Animation _voiceAnimation; + + late AnimationController _giftController; + late Animation _giftAnimation; + + late AnimationController _emojiController; + late Animation _emojiAnimation; + + late AnimationController _moreController; + late Animation _moreAnimation; + + List messageList = [ + {"avatar": "assets/user_avatar.png", "message": "你好", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "你好", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "这周六有空吗?", "type": 2}, + {"avatar": "assets/user_avatar.png", "message": "周六时间不方便,我们约周日下午可以吗?", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "那周六不见不散", "type": 2}, + {"avatar": "assets/user_avatar.png", "message": "你好", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "这周六有空吗?", "type": 2}, + {"avatar": "assets/user_avatar.png", "message": "周六时间不方便,我们约周日下午可以吗?", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "那周六不见不散", "type": 2}, + {"avatar": "assets/user_avatar.png", "message": "你好", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "这周六有空吗?", "type": 2}, + {"avatar": "assets/user_avatar.png", "message": "周六时间不方便,我们约周日下午可以吗?", "type": 1}, + {"avatar": "assets/user_avatar.png", "message": "那周六不见不散", "type": 2}, + ]; + + @override + void initState() { + super.initState(); + + _voiceController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 200), + ); + + _voiceAnimation = Tween(begin: 0.0, end: 1.0).animate(_voiceController) + ..addListener(() { + setState(() {}); + }); + + _giftController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 200), + ); + + _giftAnimation = Tween(begin: 0.0, end: 1.0).animate(_giftController) + ..addListener(() { + setState(() {}); + }); + + _emojiController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 200), + ); + + _emojiAnimation = Tween(begin: 0.0, end: 1.0).animate(_emojiController) + ..addListener(() { + setState(() {}); + }); + + _moreController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 200), + ); + + _moreAnimation = Tween(begin: 0.0, end: 1.0).animate(_moreController) + ..addListener(() { + setState(() {}); + }); + + + + + WidgetsBinding.instance.addPostFrameCallback((_) { + _messageScrollController.animateTo( + _messageScrollController.position.maxScrollExtent, // 滚动到最大可滚动位置 + duration: const Duration(milliseconds: 300), + curve: Curves.easeOut, + ); + }); + } + + + @override + void dispose() { + super.dispose(); + _controller.dispose(); + _voiceController.dispose(); + _giftController.dispose(); + _emojiController.dispose(); + _moreController.dispose(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: (){ + _emojiController.reverse(); + _voiceController.reverse(); + _giftController.reverse(); + _moreController.reverse(); + FocusScope.of(context).unfocus(); + }, + child: Scaffold( + backgroundColor: const Color.fromRGBO(250, 250, 250, 1), + appBar: PageAppbar(title: "林园园", right: Container( + margin: EdgeInsets.only(right: 28.w), + child: InkWell( + child: Image.asset( + "assets/menu_icon.png", + width: 31.w, + height: 35.w, + ), + ), + ),), + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + controller: _messageScrollController, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 20.w, + vertical: 28.w + ), + child: Column( + children: [ + Container( + width: 710.w, + height: 351.w, + padding: EdgeInsets.all(20.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + border: Border.all(width: 1, color: const Color.fromRGBO(117, 98, 249, .32)), + gradient: LinearGradient( + begin: Alignment.topCenter, // 对应 180deg:从上到下 + end: Alignment.bottomCenter, + colors: [ + Color.fromRGBO(248, 242, 255, 1), // 顶部透明白 + Color.fromRGBO(255, 255, 255, 1), // 底部纯白 + ], + stops: [0.0, 1.0], + ), + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + "林媛媛", + style: TextStyle( + fontSize: 32.w, + color: const Color.fromRGBO(51, 51, 51, 1), + fontWeight: FontWeight.w500 + ), + ), + SizedBox(width: 19.w,), + Container( + width: 87.w, + height: 26.w, + margin: EdgeInsets.only(right: 8.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(26.w)), + color: const Color.fromRGBO(246, 237, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/real_name.png", + width: 16.w, + ), + SizedBox(width: 5.w,), + Text( + "实名", + style: TextStyle( + fontSize: 18.w, + color: const Color.fromRGBO(160, 92, 255, 1) + ), + ) + ], + ), + ), + Container( + width: 66.w, + height: 26.w, + margin: EdgeInsets.only(right: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(26.w)), + color: const Color.fromRGBO(234, 255, 219, 1) + ), + child: Center( + child: Text( + "在线", + style: TextStyle( + fontSize: 18.w, + color: const Color.fromRGBO(38, 199, 124, 1) + ), + ), + ), + ), + ], + ), + SizedBox(width: 14.w,), + Row( + children: [ + SizedBox(width: 12.w,), + Image.asset( + "assets/female.png", + width: 20.w, + height: 20.w, + ), + SizedBox(width: 2.w,), + Text( + "·19", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, 1), + ), + ), + SizedBox(width: 32.w,), + Text( + "北京", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, 1), + ), + ), + SizedBox(width: 32.w,), + Text( + "160cm", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, 1), + ), + ), + ], + ) + ], + ), + Container( + width: 40.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(40.w)), + border: Border.all(width: 1, color: const Color.fromRGBO(158, 149, 201, 1)) + ), + child: Center( + child: Icon( + Icons.keyboard_arrow_right, + size: 20.w, + color: const Color.fromRGBO(51, 51, 51, 1), + ), + ), + ) + ], + ), + SizedBox(height: 20.w,), + Text( + "喜欢在广州的早茶里抢最后一个虾饺,也能在深夜的猎德大桥喜欢在广州的早茶里抢最后一个虾饺,也能在深夜的猎德大桥喜欢在广州的早茶里抢最后一个虾饺,也能在深夜的猎德大桥.........", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + SizedBox(height: 14.w,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + child: Image.network( + "https://fastly.picsum.photos/id/64/800/800.jpg?hmac=NBZ4_-vqzD6p25oCeaW0H5vH-ql9zzei-SqJNeUo1QU", + width: 158.w, + height: 158.w, + ), + ), + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + child: Image.network( + "https://fastly.picsum.photos/id/985/800/800.jpg?hmac=DfRt99HFbMJ96DlN-poOhruWYRsexESE94ilLC3g1rU", + width: 158.w, + height: 158.w, + ), + ), + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + child: Image.network( + "https://fastly.picsum.photos/id/703/800/800.jpg?hmac=-bRTkPxnsiQ5kCo2tfXj6tFrXMD7YnVx7bQ0STno3Tg", + width: 158.w, + height: 158.w, + ), + ), + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + child: Image.network( + "https://fastly.picsum.photos/id/392/800/800.jpg?hmac=kG-nWTx3JQTI-0F7oq9G6VyD_3GNJg4eRUsYX4yRHgc", + width: 158.w, + height: 158.w, + ), + ), + ], + ) + ], + ), + ), + SizedBox(height: 60.w,), + Text( + "昨天 下午 14:46", + style: TextStyle( + fontSize: 21.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + ...messageList.map((e){ + if(e["type"] == 1){ + return ChatMessage(avatar: e["avatar"], message: e["message"]); + } else { + return MyMessage(avatar: e["avatar"], message: e["message"]); + } + }), + ], + ), + ), + ) + ), + Container( + padding: EdgeInsets.only( + top: 17.w, + right: 28.w, + left: 31.w + ), + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 552.w, + height: 77.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.w)), + color: const Color.fromRGBO(242, 242, 242, 1) + ), + child: Center( + child: TextField( + controller: _messageController, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: ScreenUtil().setWidth(28), + height: 1 + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 34.w + ), + hintText: "请输入聊天内容~", + + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(8.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(8.0)), + ), + ), + onChanged: (value){ + message = value; + }, + ), + ), + ), + InkWell( + onTap: (){ + messageList.add({ + "avatar": "assets/user_avatar.png", + "message": message, + "type": 2 + }); + message = ""; + + _messageController.value = TextEditingValue( + text: message, + selection: TextSelection.fromPosition(TextPosition(offset: message.length)), + ); + + + + setState(() { + + }); + + WidgetsBinding.instance.addPostFrameCallback((_) { + _messageScrollController.animateTo( + _messageScrollController.position.maxScrollExtent, // 滚动到最大可滚动位置 + duration: const Duration(milliseconds: 300), + curve: Curves.easeOut, + ); + }); + + }, + child: Container( + width: 120.w, + height: 63.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "发送", + style: TextStyle( + fontSize: 31.w, + color: Colors.white + ), + ), + ), + ), + ) + ], + ), + ), + Container( + padding: EdgeInsets.symmetric(vertical: 28.w, horizontal: 56.w), + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: (){ + _emojiController.reverse(); + _giftController.reverse(); + _moreController.reverse(); + if (_voiceController.isCompleted) { + _voiceController.reverse(); + } else { + _voiceController.forward(); + } + setState(() { + + }); + }, + child: Image.asset( + "assets/chat_voice.png", + width: 39.w, + height: 39.w, + ), + ), + InkWell( + child: Image.asset( + "assets/chat_video.png", + width: 39.w, + height: 39.w, + ), + ), + InkWell( + onTap: (){ + _voiceController.reverse(); + _emojiController.reverse(); + _moreController.reverse(); + if (_giftController.isCompleted) { + _giftController.reverse(); + } else { + _giftController.forward(); + } + setState(() { + + }); + }, + child: Image.asset( + "assets/chat_gift.png", + width: 39.w, + height: 39.w, + ), + ), + InkWell( + onTap: (){ + _voiceController.reverse(); + _giftController.reverse(); + _moreController.reverse(); + if (_emojiController.isCompleted) { + _emojiController.reverse(); + } else { + _emojiController.forward(); + } + setState(() { + + }); + }, + child: Image.asset( + "assets/chat_emoji.png", + width: 39.w, + height: 39.w, + ), + ), + InkWell( + onTap: (){ + _voiceController.reverse(); + _giftController.reverse(); + _emojiController.reverse(); + if (_moreController.isCompleted) { + _moreController.reverse(); + } else { + _moreController.forward(); + } + setState(() { + + }); + }, + child: Image.asset( + "assets/chat_more.png", + width: 39.w, + height: 39.w, + ), + ), + ], + ), + ), + AnimatedBuilder( + animation: _voiceAnimation, + builder: (BuildContext context, child) { + return Opacity( + opacity: _voiceAnimation.value, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: (){}, + child: Container( + height: 343.w * _voiceAnimation.value, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: (){ + print(1111); + }, + child: Container( + width: 196.w, + height: 196.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(196.w)), + border: Border.all(width: 1, color: const Color.fromRGBO(117, 98, 249, 1)) + ), + child: Center( + child: Container( + width: 184.w, + height: 184.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(184.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 从左开始 + end: Alignment.centerRight, // 到右结束(90度) + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 紫色 + Color.fromRGBO(61, 138, 224, 1), // 蓝色 + ], + ), + ), + child: Center( + child: Image.asset( + "assets/mic_line.png", + width: 72.w, + height: 85.w, + ), + ), + ), + ), + ), + ), + SizedBox(height: 22.w,), + Text( + "按住说话", + style: TextStyle( + fontSize:23.w, + color: const Color.fromRGBO(144, 144, 144, 1), + ), + ) + ], + ), + ), + ), + ); + }, + ), + AnimatedBuilder( + animation: _giftAnimation, + builder: (BuildContext context, child) { + return Opacity( + opacity: _giftAnimation.value, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: (){}, + child: Container( + height: 620.w * _giftAnimation.value, + child: Column( + children: [ + Container( + height: 95.w, + padding: EdgeInsets.only(left: 59.w), + child: Row( + children: [ + Text( + "互动", + style: TextStyle( + fontSize: 26.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + SizedBox(width: 80.w,), + Text( + "礼物", + style: TextStyle( + fontSize: 26.w, + color: const Color.fromRGBO(117, 98, 249, 1), + fontWeight: FontWeight.w700 + ), + ), + ], + ), + ), + Expanded( + child: Wrap( + children: [ + ...giftList.asMap().entries.map((entry){ + return GiftItem(item: entry.value, active: activeGift, index: entry.key, changeActive: changeActive); + }), + ], + ), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/rose_gift.png", + width: 43.w, + height: 43.w, + ), + SizedBox(width: 17.w,), + Text( + "9", + style: TextStyle( + fontSize: 26.w, + color: const Color.fromRGBO(51, 51, 51, 1) + ), + ), + SizedBox(width: 24.w,), + Image.asset( + "assets/first_pay.png", + width: 137.w, + height: 66.w, + ), + ], + ) , + Row( + children: [ + TDStepper( + theme: TDStepperTheme.filled, + value: giftNum, + min: 1, + onChange: (e){ + giftNum = e; + }, + ), + SizedBox(width: 18.w,), + Container( + width: 127.w, + height: 60.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(60.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 左侧开始 + end: Alignment.centerRight, // 右侧结束(90度) + colors: [ + Color.fromRGBO(61, 138, 224, 1), // 蓝色 + Color.fromRGBO(131, 89, 255, 1), // 紫色 + ], + ), + ), + child: Center( + child: Text( + "赠送", + style: TextStyle( + fontSize: 26.w, + color: Colors.white + ), + ), + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ), + ); + }, + ), + + AnimatedBuilder( + animation: _emojiAnimation, + builder: (BuildContext context, child) { + return Opacity( + opacity: _emojiAnimation.value, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: (){}, + child: Container( + height: 490.w * _emojiAnimation.value, + child: EmojiPicker( + onEmojiSelected: (Category? category, Emoji emoji) { + print(category); + print(emoji.emoji); + message += emoji.emoji; + + _messageController.value = TextEditingValue( + text: message, + selection: TextSelection.fromPosition(TextPosition(offset: message.length)), + ); + setState(() { + + }); + }, + onBackspacePressed: () { + // Do something when the user taps the backspace button (optional) + // Set it to null to hide the Backspace-Button + }, + textEditingController: _controller, + scrollController: _scrollController, + config: Config( + locale: const Locale("zh"), + height: 490.w * _emojiAnimation.value, + checkPlatformCompatibility: true, + viewOrderConfig: const ViewOrderConfig(), + emojiViewConfig: EmojiViewConfig( + // Issue: https://github.com/flutter/flutter/issues/28894 + emojiSizeMax: 28 * + (foundation.defaultTargetPlatform == + TargetPlatform.iOS + ? 1.2 + : 1.0), + noRecents: Text( + '暂无最近使用', + style: TextStyle(fontSize: 20, color: Colors.black26), + textAlign: TextAlign.center, + ) + ), + skinToneConfig: const SkinToneConfig(), + categoryViewConfig: const CategoryViewConfig(), + bottomActionBarConfig: const BottomActionBarConfig( + enabled: false + ), + searchViewConfig: const SearchViewConfig(), + ), + ), + ), + ), + ); + }, + ), + + AnimatedBuilder( + animation: _moreAnimation, + builder: (BuildContext context, child) { + return Opacity( + opacity: _moreAnimation.value, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: (){}, + child: Container( + width: 750.w, + padding: EdgeInsets.symmetric(horizontal: 53.w), + height: 343.w * _moreAnimation.value, + color: Colors.white, + child: Wrap( + spacing: 90.w, + + children: [ + InkWell( + onTap: () async { + + int sdk = 0; + if (Platform.isAndroid) { + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); + final androidInfo = await deviceInfo.androidInfo; + sdk = androidInfo.version.sdkInt; + } + var res; + if(sdk <= 32){ + res = await handlePermission( + context, + "为了上传发送图片,我们需要获取您设备的相册读取权限", + [ + Permission.photos, + ] + ); + } else { + res = true; + } + if(res){ + final ImagePicker picker = ImagePicker(); + final List list = await picker.pickMultiImage( + + // limit: 5, + ); + // setState(() { + // imageList.addAll(list); + // }); + } else { + toast("权限获取失败", context); + } + }, + child: Column( + children: [ + Container( + width: 100.w, + height: 100.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + color: const Color.fromRGBO(247, 247, 247, 1) + ), + child: Center( + child: Image.asset( + "assets/img_icon.png", + width: 69.w, + height: 69.w, + ), + ), + ), + SizedBox(height: 13.w,), + Text( + "图片", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, 1) + ), + ) + ], + ), + ), + InkWell( + onTap: () async { + var res = await handlePermission( + context, + "为了拍照上传发送图片,我们需要获取您设备的相机和相册存取权限", + [ + Permission.camera, + Permission.photos, + Permission.storage, + ] + ); + if(res){ + final ImagePicker _picker = ImagePicker(); + final XFile? image = await _picker.pickImage(source: ImageSource.camera); + + if (image != null) { + // 这里你可以使用image.path来访问图片的本地路径 + // 或者使用image.readAsBytes()来获取图片的字节数据 + // 例如,你可以将图片显示在屏幕上,或者上传到服务器 + // 这里只打印图片路径作为示例 + print(image.path); + } + } else { + toast("权限获取失败", context); + } + }, + child: Column( + children: [ + Container( + width: 100.w, + height: 100.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + color: const Color.fromRGBO(247, 247, 247, 1) + ), + child: Center( + child: Image.asset( + "assets/camera_icon.png", + width: 69.w, + height: 69.w, + ), + ), + ), + SizedBox(height: 13.w,), + Text( + "相机", + style: TextStyle( + fontSize: 23.w, + color: const Color.fromRGBO(51, 51, 51, 1) + ), + ) + ], + ), + ), + ], + ), + ), + ), + ); + }, + ), + ], + ), + ), + ); + } +} + + + +class GiftItem extends StatefulWidget { + final Map item; + final int active; + final int index; + final void Function(int) changeActive; + const GiftItem({super.key, required this.item, required this.active, required this.index, required this.changeActive, }); + + @override + State createState() => _GiftItemState(); +} + +class _GiftItemState extends State { + @override + Widget build(BuildContext context) { + return InkWell( + onTap: (){ + widget.changeActive(widget.index); + }, + child: Container( + width: 167.w, + height: 189.w, + padding: EdgeInsets.only(top: 21.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + color: Color.fromRGBO(117, 98, 249, widget.active == widget.index ? .2 : 0), + border: Border.all(width: 1, color: Color.fromRGBO(117, 98, 249, widget.active == widget.index ? 1 : 0)) + ), + child: Column( + children: [ + Image.asset( + widget.item["icon"], + width: 82.w, + height: 82.w, + ), + SizedBox(height: 15.w,), + Text( + widget.item["title"], + style: TextStyle( + fontSize: 22.w, + color: const Color.fromRGBO(51, 51, 51, 1) + ), + ), + SizedBox(height: 2.w,), + Text( + "${widget.item["price"]}支", + style: TextStyle( + fontSize: 15.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/notify_page.dart b/lib/pages/notify_page.dart new file mode 100644 index 0000000..f5f0c8b --- /dev/null +++ b/lib/pages/notify_page.dart @@ -0,0 +1,50 @@ +import 'package:dating_touchme_app/components/chat_message.dart'; +import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class NotifyPage extends StatefulWidget { + const NotifyPage({super.key}); + + @override + State createState() => _NotifyPageState(); +} + +class _NotifyPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color.fromRGBO(250, 250, 250, 1), + appBar: PageAppbar(title: "系统通知", right: Container( + margin: EdgeInsets.only(right: 28.w), + child: InkWell( + child: Image.asset( + "assets/notify_icon.png", + width: 31.w, + height: 35.w, + ), + ), + ),), + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 29.w), + child: Column( + children: [ + SizedBox(height: 56.w,), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ChatMessage(avatar: "assets/system_notifi.png", message: "【专属福利】收到2张公开体验卡,助你免费公开连线,快速脱单,有效期1天,价值40玫瑰"), + ], + ), + ), + ), + ); + } +} diff --git a/lib/router/app_router.dart b/lib/router/app_router.dart index 169ea23..d8d05f1 100644 --- a/lib/router/app_router.dart +++ b/lib/router/app_router.dart @@ -2,6 +2,8 @@ import 'package:dating_touchme_app/pages/complete_info.dart'; import 'package:dating_touchme_app/pages/home_page.dart'; import 'package:dating_touchme_app/pages/live_room_page.dart'; import 'package:dating_touchme_app/pages/login_page.dart'; +import 'package:dating_touchme_app/pages/message_page.dart'; +import 'package:dating_touchme_app/pages/notify_page.dart'; import 'package:dating_touchme_app/pages/open_webview.dart'; import 'package:dating_touchme_app/pages/test_page.dart'; import 'package:dating_touchme_app/pages/user_info_page.dart'; @@ -67,6 +69,19 @@ class AppRouter { return LiveRoomPage(id: id,); }, ), + GoRoute( + name: RouteNames.notify, + path: RoutePaths.notify, + builder: (context, state) => const NotifyPage(), + ), + GoRoute( + name: RouteNames.message, + path: RoutePaths.message, + builder: (context, state) { + final id = int.parse(state.uri.queryParameters['id'] ?? '0'); + return MessagePage(id: id,); + }, + ), GoRoute( name: RouteNames.test, path: RoutePaths.test, diff --git a/lib/router/route_paths.dart b/lib/router/route_paths.dart index 6e2cd69..dc6a53a 100644 --- a/lib/router/route_paths.dart +++ b/lib/router/route_paths.dart @@ -6,6 +6,8 @@ class RouteNames { static const completeInfo = 'completeInfo'; static const userInfo = 'userInfo'; static const liveRoom = 'liveRoom'; + static const notify = 'notify'; + static const message = 'message'; static const test = 'test'; } @@ -16,5 +18,7 @@ class RoutePaths { static const completeInfo = '/completeInfo'; static const userInfo = '/userInfo'; static const liveRoom = '/liveRoom'; + static const notify = '/notify'; + static const message = '/message'; static const test = '/test'; } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index cf6189a..bc3d5c3 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -23,47 +23,41 @@ String formattedTime(int timestamp){ -Future handlePermission(BuildContext context, String content) async { - PermissionStatus status; - status = await Permission.location.status; - +Future handlePermission(BuildContext context, String content, List permissions) async { + var status = await permissions[0].status; final Completer completer = Completer(); - if (status.isDenied) { - // 如果没有权限,显示权限提示弹窗 + // 无权限的话就显示设置页面 showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text("提示"), - content: Text(content), - actions: [ - TextButton( - child: Text("确定"), - onPressed: () async { - Map statuses; - statuses = await [ - Permission.location, - ].request(); - - Navigator.of(context).pop(); - completer.complete(true); - }, - ), - TextButton( - child: Text("取消"), - onPressed: () { - Navigator.of(context).pop(); - completer.complete(false); - }, - ), - ], - ); - }, - ); + context: context, + builder: (BuildContext context) { + // 返回一个 AlertDialog 组件 + return AlertDialog( + title: Text("提示"), + content: Text(content), + actions: [ + // 通常是按钮 + TextButton( + child: Text("确认"), + onPressed: () async { + Map statuses = await permissions.request(); + Navigator.of(context).pop(); + completer.complete(true); + }, + ), + // 通常是按钮 + TextButton( + child: Text("取消"), + onPressed: () { + Navigator.of(context).pop(); + completer.complete(false); + }, + ), + ], + ); + }); } else { completer.complete(true); } - return completer.future; } \ No newline at end of file diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 64a0ece..58da7cf 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,9 +6,13 @@ #include "generated_plugin_registrant.h" +#include #include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin"); + emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar); g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); file_selector_plugin_register_with_registrar(file_selector_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2db3c22..7d327f4 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + emoji_picker_flutter file_selector_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 6a65a78..f0b169f 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,12 +6,16 @@ import FlutterMacOS import Foundation import agora_rtc_engine +import device_info_plus +import emoji_picker_flutter import file_selector_macos import iris_method_channel import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 4ac788a..380be90 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,6 +121,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.8" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.1.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.2" dio: dependency: "direct main" description: @@ -145,6 +161,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.4.0" + emoji_picker_flutter: + dependency: "direct main" + description: + name: emoji_picker_flutter + sha256: "9a44c102079891ea5877f78c70f2e3c6e9df7b7fe0a01757d31f1046eeaa016d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.3.0" fake_async: dependency: transitive description: @@ -885,6 +909,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.14.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.5.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.5" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 223a1ce..9787558 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,6 +49,8 @@ dependencies: roundcheckbox: ^2.0.5 webview_flutter: ^4.7.0 flutter_datetime_picker_plus: ^2.2.0 + emoji_picker_flutter: ^4.3.0 + device_info_plus: ^10.1.0 dependency_overrides: tdesign_flutter_adaptation: 3.16.0 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 16d71f5..9d6db11 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include #include @@ -14,6 +15,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { AgoraRtcEnginePluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin")); + EmojiPickerFlutterPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); IrisMethodChannelPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 970ef46..73cfd3f 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST agora_rtc_engine + emoji_picker_flutter file_selector_windows iris_method_channel permission_handler_windows