Skip to content

Commit

Permalink
flutter clean
Browse files Browse the repository at this point in the history
  • Loading branch information
2b-creator committed May 16, 2024
1 parent 2091c70 commit 9ce48eb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/screens/chat_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class _ChatScreenState extends State<ChatScreen> {
),
Gap(15),
Text(
"Search message...",
"搜索信息",
style: TextStyle(
fontSize: 18,
color: Color.fromARGB(255, 128, 128, 128),
Expand Down
30 changes: 15 additions & 15 deletions lib/screens/message_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,21 +361,21 @@ class _MessageScreenState extends State<MessageScreen> {
),
VerticalDivider(color: Colors.black.withOpacity(0.2)),
const Gap(15),
Row(
children: [
Icon(
Icons.mood,
size: 25,
color: Colors.black.withOpacity(0.5),
),
const Gap(17),
Icon(
Icons.photo_camera,
size: 25,
color: Colors.black.withOpacity(0.5),
),
],
),
// Row(
// children: [
// Icon(
// Icons.mood,
// size: 25,
// color: Colors.black.withOpacity(0.5),
// ),
// const Gap(17),
// Icon(
// Icons.photo_camera,
// size: 25,
// color: Colors.black.withOpacity(0.5),
// ),
// ],
// ),
],
),
),
Expand Down
45 changes: 33 additions & 12 deletions lib/screens/profile_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// ignore_for_file: use_build_context_synchronously

import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import '../screens/welcome_screen.dart';
import 'package:matrix/matrix.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import '../utils/dialogs.dart';
import 'package:hanhai/main.dart';

Expand All @@ -19,13 +23,25 @@ class _ProfileScreenState extends State<ProfileScreen> {
int i = 0;
String? user = "default";
Uri? url;
void _changeAvatarChoser() async {
final ImagePicker picker = ImagePicker();
final XFile? response = await picker.pickImage(source: ImageSource.gallery);
if (response==null) {
return;
}
//final List<XFile>? files = response.files;
String filePath = response.path;
Uint8List uint8list = await File(filePath).readAsBytes();
widget.client.setAvatar(MatrixImageFile(bytes: uint8list, name: widget.client.clientName.toString()));
}

logout() async {
questionDialog(
context: context,
title: "Logout",
content: "Are you sure want to logout from your account?",
title: "登出",
content: "你确定要登出你的账户吗",
func: () async {

final client = widget.client;
await client.logout();
Navigator.of(context).pushAndRemoveUntil(
Expand All @@ -36,7 +52,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("You are successfully logged out."),
content: Text("你已成功登出"),
backgroundColor: Colors.green,
),
);
Expand Down Expand Up @@ -88,7 +104,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
appBar: AppBar(
title: const Center(
child: Text(
"My Profile",
"个人中心",
),
),
),
Expand Down Expand Up @@ -128,20 +144,25 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
),
),
Center(child: TextButton(onPressed: _changeAvatarChoser, child: const Text("更改头像")),),
const Gap(20),
const Divider(thickness: 2, endIndent: 15, indent: 15),
const Gap(20),
Text(
user!,
Center(child: Container(width: 250,child: TextField(
textAlign: TextAlign.center,
decoration: InputDecoration(hintText: user!),
onSubmitted: (value) async {
await widget.client.setDisplayName(widget.client.userID!, value);
},
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
Text(
"@${user!}",
style: const TextStyle(fontSize: 15),
),
),),),
// Text(
// "@${widget.client.userID!}",
// style: const TextStyle(fontSize: 15),
// ),
const Gap(20),
const Divider(thickness: 2, endIndent: 15, indent: 15),
const Gap(20),
Expand Down Expand Up @@ -214,7 +235,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
Icon(Icons.logout_outlined, size: 28),
Gap(10),
Text(
"Log Out",
"登出",
style: TextStyle(fontSize: 20),
),
],
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 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: 3.0.0+2
version: 3.9.0+1

environment:
sdk: '>=3.3.3 <4.0.0'
Expand Down

0 comments on commit 9ce48eb

Please sign in to comment.