diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 36bf73c..6bf1717 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,7 +2,8 @@ + android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true"> + + + diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index a439442..80dfb24 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -19,7 +19,7 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("com.android.application") version "8.7.0" apply false - id("org.jetbrains.kotlin.android") version "1.8.22" apply false + id("org.jetbrains.kotlin.android") version "1.9.22" apply false } include(":app") diff --git a/lib/apis/auth_api.dart b/lib/apis/auth_api.dart new file mode 100644 index 0000000..156ab89 --- /dev/null +++ b/lib/apis/auth_api.dart @@ -0,0 +1,11 @@ +import 'package:sweet_chat_app/models/auth.dart'; +import 'package:sweet_chat_app/services/dio_service.dart'; + +Future loginApi(String username, String password) async { + final res = await dioService.post( + '/auth/login', + data: {'username': username, 'password': password}, + ); + + return Auth.fromJson(res.data); +} diff --git a/lib/apis/user_api.dart b/lib/apis/user_api.dart new file mode 100644 index 0000000..8b1825a --- /dev/null +++ b/lib/apis/user_api.dart @@ -0,0 +1,10 @@ +import 'package:sweet_chat_app/models/user.dart'; +import 'package:sweet_chat_app/services/dio_service.dart'; + +Future> getUserFriendsApi(int userId) async { + final res = await dioService.get('/user/friend/$userId'); + + if (res.data == null) return []; + + return (res.data as List).map((e) => User.fromJson(e)).toList(); +} diff --git a/lib/main.dart b/lib/main.dart index c6f3bed..8c6141a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:liquid_glass_widgets/liquid_glass_widgets.dart'; import 'package:sweet_chat_app/pages/login.dart'; +import 'package:sweet_chat_app/utils/SpUtil.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + await SpUtil.init(); // 预编译 shader,防止首帧白闪 await LiquidGlassWidgets.initialize(); // wrap() 安装无障碍桥接、全局主题、自适应质量 diff --git a/lib/models/ImMessage.dart b/lib/models/ImMessage.dart new file mode 100644 index 0000000..ca0abd6 --- /dev/null +++ b/lib/models/ImMessage.dart @@ -0,0 +1,20 @@ +class ImMessage { + final String type; + final String from; + final String to; + final String content; + + ImMessage({ + required this.type, + required this.from, + required this.to, + required this.content, + }); + + Map toJson() => { + 'type': type, + 'from': from, + 'to': to, + 'content': content, + }; +} \ No newline at end of file diff --git a/lib/models/auth.dart b/lib/models/auth.dart new file mode 100644 index 0000000..736f2ab --- /dev/null +++ b/lib/models/auth.dart @@ -0,0 +1,14 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'auth.g.dart'; + +@JsonSerializable() +class Auth { + final int userId; + + Auth({required this.userId}); + + factory Auth.fromJson(Map json) => _$AuthFromJson(json); + + Map toJson() => _$AuthToJson(this); +} diff --git a/lib/models/auth.g.dart b/lib/models/auth.g.dart new file mode 100644 index 0000000..93069f2 --- /dev/null +++ b/lib/models/auth.g.dart @@ -0,0 +1,14 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'auth.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Auth _$AuthFromJson(Map json) => + Auth(userId: (json['userId'] as num).toInt()); + +Map _$AuthToJson(Auth instance) => { + 'userId': instance.userId, +}; diff --git a/lib/models/user.dart b/lib/models/user.dart new file mode 100644 index 0000000..6c0b7a7 --- /dev/null +++ b/lib/models/user.dart @@ -0,0 +1,28 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'user.g.dart'; + +@JsonSerializable() +class User { + final int id; + final String phone; + final String nickname; + final String avatarUrl; + final int gender; + final DateTime createTime; + final DateTime updateTime; + + User({ + required this.id, + required this.phone, + required this.nickname, + required this.avatarUrl, + required this.gender, + required this.createTime, + required this.updateTime, + }); + + factory User.fromJson(Map json) => _$UserFromJson(json); + + Map toJson() => _$UserToJson(this); +} diff --git a/lib/models/user.g.dart b/lib/models/user.g.dart new file mode 100644 index 0000000..8338e3e --- /dev/null +++ b/lib/models/user.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +User _$UserFromJson(Map json) => User( + id: (json['id'] as num).toInt(), + phone: json['phone'] as String, + nickname: json['nickname'] as String, + avatarUrl: json['avatarUrl'] as String, + gender: (json['gender'] as num).toInt(), + createTime: DateTime.parse(json['createTime'] as String), + updateTime: DateTime.parse(json['updateTime'] as String), +); + +Map _$UserToJson(User instance) => { + 'id': instance.id, + 'phone': instance.phone, + 'nickname': instance.nickname, + 'avatarUrl': instance.avatarUrl, + 'gender': instance.gender, + 'createTime': instance.createTime.toIso8601String(), + 'updateTime': instance.updateTime.toIso8601String(), +}; diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart index 03bb7fc..ae2b52a 100644 --- a/lib/pages/chat_page.dart +++ b/lib/pages/chat_page.dart @@ -1,5 +1,10 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:liquid_glass_widgets/liquid_glass_widgets.dart'; +import 'package:sweet_chat_app/models/ImMessage.dart'; +import 'package:sweet_chat_app/services/webSocket_service.dart'; +import 'package:sweet_chat_app/utils/SpUtil.dart'; class ChatMessage { final String text; @@ -34,10 +39,45 @@ class _ChatPageState extends State { super.initState(); _messages = [ - ChatMessage(text: '在吗?', isMe: false, avatar: widget.avatarUrl), - ChatMessage(text: '在的,怎么啦 😊', isMe: true), - ChatMessage(text: '今晚一起吃饭吗?', isMe: false, avatar: widget.avatarUrl), + // ChatMessage(text: '在吗?', isMe: false, avatar: widget.avatarUrl), + // ChatMessage(text: '在的,怎么啦 😊', isMe: true), + // ChatMessage(text: '今晚一起吃饭吗?', isMe: false, avatar: widget.avatarUrl), ]; + + final userId = SpUtil.getInt('userId') ?? 0; + final online = ImMessage( + type: "ONLINE", + from: userId.toString(), + to: '', + content: '', + ); + + WebSocketService().connect('ws://192.168.31.108:5050?userId=$userId'); + WebSocketService().send(jsonEncode(online.toJson())); + + WebSocketService().messages.listen((msg) { + print('收到消息: $msg'); + + setState(() { + _messages.add(ChatMessage(text: msg, isMe: false, avatar: widget.avatarUrl)); + }); + + _controller.clear(); + + Future.delayed(const Duration(milliseconds: 100), () { + _scrollController.animateTo( + _scrollController.position.maxScrollExtent, + duration: const Duration(milliseconds: 300), + curve: Curves.easeOut, + ); + }); + }); + } + + @override + void dispose() { + super.dispose(); + WebSocketService().disconnect(); } void _sendMessage() { diff --git a/lib/pages/contacts_page.dart b/lib/pages/contacts_page.dart index bef879b..ee356d3 100644 --- a/lib/pages/contacts_page.dart +++ b/lib/pages/contacts_page.dart @@ -1,6 +1,11 @@ import 'package:azlistview/azlistview.dart'; import 'package:flutter/material.dart'; import 'package:lpinyin/lpinyin.dart'; +import 'package:sweet_chat_app/apis/user_api.dart'; +import 'package:sweet_chat_app/models/user.dart'; +import 'package:sweet_chat_app/utils/SpUtil.dart'; + +import 'chat_page.dart'; class ContactInfo extends ISuspensionBean { final String name; @@ -29,54 +34,39 @@ class ContactsPage extends StatefulWidget { class _ContactsPageState extends State { List contactList = []; - List topList = []; @override void initState() { super.initState(); - _loadFakeData(); + _loadFriends(); } - void _loadFakeData() { - contactList = [ - ContactInfo(name: '张三', avatar: 'https://picsum.photos/id/1011/200'), - ContactInfo(name: '李四', avatar: 'https://picsum.photos/id/1012/200'), - ContactInfo(name: '王五', avatar: 'https://picsum.photos/id/1013/200'), - ContactInfo(name: '赵六', avatar: 'https://picsum.photos/id/1014/200'), - ContactInfo(name: '陈七', avatar: 'https://picsum.photos/id/1015/200'), - ContactInfo(name: '刘八', avatar: 'https://picsum.photos/id/1016/200'), - ContactInfo(name: '周九', avatar: 'https://picsum.photos/id/1017/200'), - ContactInfo(name: '吴十', avatar: 'https://picsum.photos/id/1018/200'), - ContactInfo(name: '欧阳峰', avatar: 'https://picsum.photos/id/1021/200'), - ContactInfo(name: '诸葛青', avatar: 'https://picsum.photos/id/1022/200'), - ContactInfo(name: '司马光', avatar: 'https://picsum.photos/id/1023/200'), - ContactInfo(name: '慕容复', avatar: 'https://picsum.photos/id/1024/200'), - ContactInfo(name: '安琪拉', avatar: 'https://picsum.photos/id/1031/200'), - ContactInfo(name: '亚瑟', avatar: 'https://picsum.photos/id/1032/200'), - ContactInfo(name: '李白', avatar: 'https://picsum.photos/id/1033/200'), - ContactInfo(name: '韩信', avatar: 'https://picsum.photos/id/1034/200'), - ContactInfo(name: '孙尚香', avatar: 'https://picsum.photos/id/1035/200'), - ContactInfo(name: '鲁班', avatar: 'https://picsum.photos/id/1036/200'), - ContactInfo(name: '妲己', avatar: 'https://picsum.photos/id/1037/200'), - ContactInfo(name: '甄姬', avatar: 'https://picsum.photos/id/1038/200'), - ]; + Future _loadFriends() async { + final userId = SpUtil.getInt('userId') ?? 0; + final friendList = await getUserFriendsApi(userId); - _handleList(contactList); + setState(() { + _handleList(friendList); + }); } - void _handleList(List list) { - for (var item in list) { - final pinyin = PinyinHelper.getPinyinE(item.name); - final tag = pinyin.substring(0, 1).toUpperCase(); - item.namePinyin = pinyin; - item.tagIndex = RegExp(r'[A-Z]').hasMatch(tag) ? tag : '#'; - } + void _handleList(List friends) { + contactList = + friends.map((user) { + final pinyin = PinyinHelper.getPinyinE(user.nickname); + final tag = pinyin.substring(0, 1).toUpperCase(); - SuspensionUtil.sortListBySuspensionTag(list); - SuspensionUtil.setShowSuspensionStatus(list); + return ContactInfo( + name: user.nickname, + avatar: user.avatarUrl, + tagIndex: RegExp(r'^[A-Z]$').hasMatch(tag) ? tag : '#', + namePinyin: pinyin, + ); + }).toList(); - setState(() {}); + SuspensionUtil.sortListBySuspensionTag(contactList); + SuspensionUtil.setShowSuspensionStatus(contactList); } @override @@ -112,18 +102,17 @@ class _ContactsPageState extends State { data: contactList, itemCount: contactList.length, itemBuilder: (_, index) { - final c = contactList[index]; - return Container( - child: ListTile( - leading: CircleAvatar( - backgroundImage: NetworkImage(c.avatar), - onBackgroundImageError: (_, __) {}, - ), - title: Text( - c.name, - style: const TextStyle(fontSize: 16, color: Colors.white), - ), + final contact = contactList[index]; + return ListTile( + leading: CircleAvatar( + backgroundImage: NetworkImage(contact.avatar), + onBackgroundImageError: (_, __) {}, ), + title: Text( + contact.name, + style: const TextStyle(fontSize: 16, color: Colors.white), + ), + onTap: () => onTapContact(contact), ); }, susItemBuilder: (_, index) { @@ -167,4 +156,17 @@ class _ContactsPageState extends State { ), ); } + + void onTapContact(ContactInfo contact) { + Navigator.push( + context, + MaterialPageRoute( + builder: + (_) => ChatPage( + contactName: contact.name, + avatarUrl: contact.avatar, + ), + ), + ); + } } diff --git a/lib/pages/login.dart b/lib/pages/login.dart index 14e9582..42eecd2 100644 --- a/lib/pages/login.dart +++ b/lib/pages/login.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:liquid_glass_widgets/liquid_glass_widgets.dart'; +import 'package:sweet_chat_app/apis/auth_api.dart'; +import 'package:sweet_chat_app/utils/SpUtil.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; import '../services/webSocket_service.dart'; @@ -16,21 +19,33 @@ class _LoginPageState extends State { final _usernameController = TextEditingController(); final _passwordController = TextEditingController(); - void _login() { - print('username: ${_usernameController.text}'); - print('password: ${_passwordController.text}'); + void _login() async { + try { + final auth = await loginApi(_usernameController.text, _passwordController.text); + await SpUtil.setInt('userId', auth.userId); - WebSocketService().connect('ws://127.0.0.1:5050?userId=123'); - - WebSocketService().messages.listen((msg) { - print('收到消息: $msg'); - }); - - // Navigator.of(context).push( - // MaterialPageRoute( - // builder: (_) => const HomePage(), - // ), - // ); + Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => const HomePage(), + ), + ); + + Fluttertoast.showToast( + msg: "登录成功", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.TOP, + backgroundColor: Colors.white, + textColor: Colors.black, + ); + } catch (e) { + Fluttertoast.showToast( + msg: "登录失败", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.TOP, + backgroundColor: Colors.white, + textColor: Colors.black, + ); + } } @override diff --git a/lib/services/dio_service.dart b/lib/services/dio_service.dart new file mode 100644 index 0000000..42dee09 --- /dev/null +++ b/lib/services/dio_service.dart @@ -0,0 +1,7 @@ +import 'package:dio/dio.dart'; + +final dioService = Dio(BaseOptions( + baseUrl: 'http://192.168.31.108:2836/api', + connectTimeout: Duration(seconds: 10), + headers: {'Content-Type': 'application/json'}, +)); \ No newline at end of file diff --git a/lib/utils/SpUtil.dart b/lib/utils/SpUtil.dart new file mode 100644 index 0000000..40012d5 --- /dev/null +++ b/lib/utils/SpUtil.dart @@ -0,0 +1,23 @@ +import 'package:shared_preferences/shared_preferences.dart'; + +class SpUtil { + static late SharedPreferences _sp; + + static Future init() async { + _sp = await SharedPreferences.getInstance(); + } + + static Future setString(String key, String value) => + _sp.setString(key, value); + + static String? getString(String key) => _sp.getString(key); + + static Future setInt(String key, int value) => + _sp.setInt(key, value); + + static int? getInt(String key) => _sp.getInt(key); + + static Future remove(String key) => _sp.remove(key); + + static Future clear() => _sp.clear(); +} \ No newline at end of file diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..724bb2a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,8 @@ import FlutterMacOS import Foundation +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 2d319f0..fcd58d5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,30 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "8d7ff3948166b8ec5da0fbb5962000926b8e02f2ed9b3e51d1738905fbd4c98d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "93.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: de7148ed2fcec579b19f122c1800933dfa028f6d9fd38a152b04b1516cec120b + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.0.1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.7.0" async: dependency: transitive description: @@ -25,6 +49,54 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: a156715e7cd728130c592f30552575908aae5b100005fbc1f0fb16b3c03a3d10 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.6" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4070d2a59f8eec34c97c86ceb44403834899075f66e8a9d59706f8e7834f6f71" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.1" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "1523ce62448ebac2c15a8ba5fbad8acac169788658a7dd2a1c2d9c2a9318b9a6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.15.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "34e4067d30ce212937df995f03b69992eea683539ceeac7f679a1f1eba055b56" + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.12.6" characters: dependency: transitive description: @@ -33,6 +105,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.4" clock: dependency: transitive description: @@ -49,6 +129,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.2" crypto: dependency: transitive description: @@ -65,6 +153,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "29f7ecc274a86d32920b1d9cfc7502fa87220da41ec60b55f329559d5732e2b2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.7" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" equatable: dependency: transitive description: @@ -81,6 +193,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -107,6 +243,75 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: "90778fe0497fe3a09166e8cf2e0867310ff434b794526589e77ec03cf08ba8e8" + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.2.14" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.5" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.12.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: ffcd10cde35a93b2abbbcc26bd9971f4ca93763e8abe78d855e3c4177797e501 + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.14.0" leak_tracker: dependency: transitive description: @@ -187,6 +392,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.17.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" path: dependency: transitive description: @@ -195,6 +416,70 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.9.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.0" scrollable_positioned_list: dependency: transitive description: @@ -203,11 +488,99 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.2.3" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.5" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: e8d4762b1e2e8578fc4d0fd548cebf24afd24f49719c08974df92834565e2c53 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.23" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: ec37cc0e6694374cbef59ed79685572c870a54ede6fa30a3e420feb3adffea02 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.2.3" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "4227d54ceefd0bb8ca4c8fcb96e1719dc53f1ee1b6e2ca9d7a6069da160e4eae" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.12" source_span: dependency: transitive description: @@ -232,6 +605,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" string_scanner: dependency: transitive description: @@ -280,6 +661,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "14.3.1" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.1" web: dependency: transitive description: @@ -304,6 +693,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.3" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.3" sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.10.0 <4.0.0" + flutter: ">=3.38.0" diff --git a/pubspec.yaml b/pubspec.yaml index f0c9f0d..eabed6d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1 +1 @@ -name: sweet_chat_app description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: sdk: ^3.7.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 liquid_glass_widgets: ^0.16.1 azlistview: ^2.0.0 lpinyin: ^2.0.3 web_socket_channel: ^3.0.3 dev_dependencies: flutter_test: sdk: flutter # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images # For details regarding adding assets from package dependencies, see # https://flutter.dev/to/asset-from-package # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package \ No newline at end of file +name: sweet_chat_app description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: sdk: ^3.7.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 liquid_glass_widgets: ^0.16.1 azlistview: ^2.0.0 lpinyin: ^2.0.3 web_socket_channel: ^3.0.3 dio: ^5.7.0 json_annotation: ^4.9.0 fluttertoast: ^8.2.4 shared_preferences: ^2.5.5 dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.4.8 json_serializable: ^6.8.0 flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images # For details regarding adding assets from package dependencies, see # https://flutter.dev/to/asset-from-package # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package \ No newline at end of file