fix: v1.1.3+5 - profile/messages click + home refresh
This commit is contained in:
parent
77e6315c5b
commit
81a00bd79b
@ -65,7 +65,17 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Future<void> _refreshActivities() async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
|
if (index == 0 && _selectedIndex == 0) {
|
||||||
|
_refreshActivities();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (index == 2) {
|
if (index == 2) {
|
||||||
// 中间按钮 - 跳转到发布页面
|
// 中间按钮 - 跳转到发布页面
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
@ -81,9 +91,11 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(() {
|
if (_selectedIndex != index) {
|
||||||
_selectedIndex = index;
|
setState(() {
|
||||||
});
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -113,10 +125,7 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: _refreshActivities,
|
||||||
await Future.delayed(Duration(seconds: 1));
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
child: MasonryGridView.count(
|
child: MasonryGridView.count(
|
||||||
|
|||||||
@ -22,91 +22,98 @@ class MessagesScreen extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
itemCount: _mockMessages.length,
|
itemCount: _mockMessages.length,
|
||||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||||
itemBuilder: (context, index) => _buildMessageTile(_mockMessages[index]),
|
itemBuilder: (context, index) => _buildMessageTile(context, _mockMessages[index]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMessageTile(Map<String, dynamic> message) {
|
Widget _buildMessageTile(BuildContext context, Map<String, dynamic> message) {
|
||||||
final unread = message['unread'] as int;
|
final unread = message['unread'] as int;
|
||||||
return InkWell(
|
return Material(
|
||||||
borderRadius: BorderRadius.circular(14),
|
color: Colors.transparent,
|
||||||
onTap: () {
|
child: Ink(
|
||||||
// TODO: 跳转会话详情页
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: InkWell(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(14),
|
||||||
CircleAvatar(
|
onTap: () {
|
||||||
radius: 24,
|
ScaffoldMessenger.of(context)
|
||||||
backgroundColor: const Color(0xFFFFE7CF),
|
..hideCurrentSnackBar()
|
||||||
backgroundImage: NetworkImage('https://i.pravatar.cc/50?img=${message['avatar']}'),
|
..showSnackBar(const SnackBar(content: Text('功能开发中,敬请期待')));
|
||||||
),
|
},
|
||||||
const SizedBox(width: 12),
|
child: Padding(
|
||||||
Expanded(
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message['name'] as String,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF333333),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Text(
|
|
||||||
message['preview'] as String,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Color(0xFF8A8A8A),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
CircleAvatar(
|
||||||
message['time'] as String,
|
radius: 24,
|
||||||
style: const TextStyle(
|
backgroundColor: const Color(0xFFFFE7CF),
|
||||||
fontSize: 12,
|
backgroundImage: NetworkImage('https://i.pravatar.cc/50?img=${message['avatar']}'),
|
||||||
color: Color(0xFF999999),
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
message['name'] as String,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xFF333333),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
message['preview'] as String,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Color(0xFF8A8A8A),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(width: 12),
|
||||||
unread > 0
|
Column(
|
||||||
? Container(
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
width: 18,
|
children: [
|
||||||
height: 18,
|
Text(
|
||||||
decoration: const BoxDecoration(
|
message['time'] as String,
|
||||||
color: Color(0xFFFF4D4F),
|
style: const TextStyle(
|
||||||
shape: BoxShape.circle,
|
fontSize: 12,
|
||||||
),
|
color: Color(0xFF999999),
|
||||||
alignment: Alignment.center,
|
),
|
||||||
child: Text(
|
),
|
||||||
'$unread',
|
const SizedBox(height: 8),
|
||||||
style: const TextStyle(
|
unread > 0
|
||||||
color: Colors.white,
|
? Container(
|
||||||
fontSize: 10,
|
width: 18,
|
||||||
fontWeight: FontWeight.w700,
|
height: 18,
|
||||||
),
|
decoration: const BoxDecoration(
|
||||||
),
|
color: Color(0xFFFF4D4F),
|
||||||
)
|
shape: BoxShape.circle,
|
||||||
: const SizedBox(height: 18),
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'$unread',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(height: 18),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -41,11 +41,11 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _openProfileSetup() async {
|
Future<void> _openProfileSetup() async {
|
||||||
await Navigator.push(
|
await Navigator.of(context).push(
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (_) => const ProfileSetupScreen()),
|
MaterialPageRoute(builder: (_) => const ProfileSetupScreen()),
|
||||||
);
|
);
|
||||||
_loadProfile();
|
if (!mounted) return;
|
||||||
|
await _loadProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: banxiang_app
|
name: banxiang_app
|
||||||
description: 伴享
|
description: 伴享
|
||||||
version: 1.1.2+4
|
version: 1.1.3+5
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
|||||||
BIN
releases/banxiang-v1.1.3+5.apk
Normal file
BIN
releases/banxiang-v1.1.3+5.apk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user