Browse Source

排版聊天页面

master
YakumoChen 4 months ago
parent
commit
92c0cc12ed
29 changed files with 1642 additions and 136 deletions
  1. 10
      android/app/src/main/AndroidManifest.xml
  2. BIN
      assets/camera_icon.png
  3. BIN
      assets/chat_emoji.png
  4. BIN
      assets/chat_gift.png
  5. BIN
      assets/chat_more.png
  6. BIN
      assets/chat_video.png
  7. BIN
      assets/chat_voice.png
  8. BIN
      assets/img_icon.png
  9. BIN
      assets/menu_icon.png
  10. BIN
      assets/mic_line.png
  11. BIN
      assets/no_chat_bg.png
  12. BIN
      assets/notify_icon.png
  13. 3
      devtools_options.yaml
  14. 63
      lib/components/chat_message.dart
  15. 64
      lib/components/my_message.dart
  16. 4
      lib/components/page_appbar.dart
  17. 395
      lib/pages/chat_page.dart
  18. 1049
      lib/pages/message_page.dart
  19. 50
      lib/pages/notify_page.dart
  20. 15
      lib/router/app_router.dart
  21. 4
      lib/router/route_paths.dart
  22. 66
      lib/utils/utils.dart
  23. 4
      linux/flutter/generated_plugin_registrant.cc
  24. 1
      linux/flutter/generated_plugins.cmake
  25. 4
      macos/Flutter/GeneratedPluginRegistrant.swift
  26. 40
      pubspec.lock
  27. 2
      pubspec.yaml
  28. 3
      windows/flutter/generated_plugin_registrant.cc
  29. 1
      windows/flutter/generated_plugins.cmake

10
android/app/src/main/AndroidManifest.xml

@ -1,4 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28" />
<application
android:label="动我"
android:name="${applicationName}"

BIN
assets/camera_icon.png

Before After
Width: 138  |  Height: 138  |  Size: 2.3 KiB

BIN
assets/chat_emoji.png

Before After
Width: 79  |  Height: 79  |  Size: 1.8 KiB

BIN
assets/chat_gift.png

Before After
Width: 78  |  Height: 84  |  Size: 7.6 KiB

BIN
assets/chat_more.png

Before After
Width: 84  |  Height: 84  |  Size: 1.2 KiB

BIN
assets/chat_video.png

Before After
Width: 90  |  Height: 68  |  Size: 937 B

BIN
assets/chat_voice.png

Before After
Width: 84  |  Height: 84  |  Size: 1.9 KiB

BIN
assets/img_icon.png

Before After
Width: 138  |  Height: 138  |  Size: 2.3 KiB

BIN
assets/menu_icon.png

Before After
Width: 64  |  Height: 52  |  Size: 415 B

BIN
assets/mic_line.png

Before After
Width: 144  |  Height: 170  |  Size: 2.2 KiB

BIN
assets/no_chat_bg.png

Before After
Width: 364  |  Height: 364  |  Size: 85 KiB

BIN
assets/notify_icon.png

Before After
Width: 63  |  Height: 70  |  Size: 990 B

3
devtools_options.yaml

@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

63
lib/components/chat_message.dart

@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ChatMessage extends StatefulWidget {
final String avatar;
final String message;
const ChatMessage({super.key, required this.avatar, required this.message});
@override
State<ChatMessage> createState() => _ChatMessageState();
}
class _ChatMessageState extends State<ChatMessage> {
@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,
)
],
),
);
}
}

64
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<MyMessage> createState() => _MyMessageState();
}
class _MyMessageState extends State<MyMessage> {
@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,
),
],
),
);
}
}

4
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(

395
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<ChatPage> {
List<String> topNav = ["聊天", "好友"];
List<Map> 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<Map> topList = [
@ -37,8 +39,18 @@ class _ChatPageState extends State<ChatPage> {
{"isFriend": false},
];
int nowActive = 0;
List<String> friendNavList = ["我的关注", "好友", "粉丝"];
int friendNavActive = 0;
void changeNav(int active) {
print("当前项: $active");
nowActive = active;
setState(() {
});
}
@override
@ -71,35 +83,120 @@ class _ChatPageState extends State<ChatPage> {
),
),),
),
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<ChatItem> {
@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<TopItem> {
}
}
class FriendItem extends StatefulWidget {
const FriendItem({super.key});
@override
State<FriendItem> createState() => _FriendItemState();
}
class _FriendItemState extends State<FriendItem> {
@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
),
),
),
)
],
),
);
}
}

1049
lib/pages/message_page.dart
File diff suppressed because it is too large
View File

50
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<NotifyPage> createState() => _NotifyPageState();
}
class _NotifyPageState extends State<NotifyPage> {
@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玫瑰"),
],
),
),
),
);
}
}

15
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,

4
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';
}

66
lib/utils/utils.dart

@ -23,47 +23,41 @@ String formattedTime(int timestamp){
Future<bool> handlePermission(BuildContext context, String content) async {
PermissionStatus status;
status = await Permission.location.status;
Future<bool> handlePermission(BuildContext context, String content, List<Permission> permissions) async {
var status = await permissions[0].status;
final Completer<bool> completer = Completer<bool>();
if (status.isDenied) {
//
//
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("提示"),
content: Text(content),
actions: <Widget>[
TextButton(
child: Text("确定"),
onPressed: () async {
Map<Permission, PermissionStatus> 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: <Widget>[
//
TextButton(
child: Text("确认"),
onPressed: () async {
Map<Permission, PermissionStatus> 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;
}

4
linux/flutter/generated_plugin_registrant.cc

@ -6,9 +6,13 @@
#include "generated_plugin_registrant.h"
#include <emoji_picker_flutter/emoji_picker_flutter_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
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);

1
linux/flutter/generated_plugins.cmake

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
emoji_picker_flutter
file_selector_linux
)

4
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"))

40
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:

2
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

3
windows/flutter/generated_plugin_registrant.cc

@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"
#include <agora_rtc_engine/agora_rtc_engine_plugin.h>
#include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <iris_method_channel/iris_method_channel_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
@ -14,6 +15,8 @@
void RegisterPlugins(flutter::PluginRegistry* registry) {
AgoraRtcEnginePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin"));
EmojiPickerFlutterPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
IrisMethodChannelPluginCApiRegisterWithRegistrar(

1
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

Loading…
Cancel
Save