You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
4.4 KiB
135 lines
4.4 KiB
4 months ago
|
import 'dart:ui';
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/rendering.dart';
|
||
|
import 'package:flutter/services.dart';
|
||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
||
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import '../../generated/l10n.dart';
|
||
|
import '../../utils/font_weight.dart';
|
||
|
import '../main.dart';
|
||
|
import '../utils/event_type.dart';
|
||
|
import '../view_widget/my_tab.dart';
|
||
|
import 'im_view/custom_underline_tabIndicator.dart';
|
||
|
import 'im_view/friend_groip_list.dart';
|
||
|
|
||
|
class ChatFriendGroup extends StatefulWidget {
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _ChatFriendGroup();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ChatFriendGroup extends State<ChatFriendGroup>
|
||
|
with SingleTickerProviderStateMixin {
|
||
|
ApiService apiService;
|
||
|
TabController tabController;
|
||
|
List<GlobalKey> _allKey = [];
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
tabController = TabController(length: 3, vsync: this, initialIndex: 0);
|
||
|
loadFinish();
|
||
|
}
|
||
|
|
||
|
loadFinish() {
|
||
|
_allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()];
|
||
|
setState(() {});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
backgroundColor: Color(0xFFFFFFFF),
|
||
|
appBar: MyAppBar(
|
||
|
title: "好友(2)",
|
||
|
titleColor: Color(0xFF0D0D0D),
|
||
|
titleSize: 17.sp,
|
||
|
leading: true,
|
||
|
leadingColor: Colors.black,
|
||
|
background: Color(0xFFFFFFFF),
|
||
|
action: GestureDetector(
|
||
|
behavior: HitTestBehavior.opaque,
|
||
|
onTap: () {
|
||
|
Navigator.of(context).pushNamed('/router/add_friend');
|
||
|
},
|
||
|
child: Container(
|
||
|
padding: EdgeInsets.all(12),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Color(0xFFFFFFFF),
|
||
|
borderRadius: BorderRadius.circular(20.r),
|
||
|
boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Color(0xFF000000).withAlpha(25),
|
||
|
offset: Offset(0, 0),
|
||
|
blurRadius: 4,
|
||
|
spreadRadius: 0,
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
child: Image.asset(
|
||
|
"assets/image/add_friend.webp",
|
||
|
fit: BoxFit.fill,
|
||
|
height: 14.h,width: 14.h,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
body: Container(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Align(
|
||
|
alignment: Alignment.centerLeft,
|
||
|
child: Theme(
|
||
|
data: ThemeData(
|
||
|
splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明
|
||
|
highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明
|
||
|
),
|
||
|
child: TabBar(
|
||
|
controller: tabController,
|
||
|
isScrollable: true,
|
||
|
//可滚动
|
||
|
labelColor: Color(0xFF060606),
|
||
|
labelStyle: TextStyle(
|
||
|
fontSize: 16.sp,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
unselectedLabelStyle: TextStyle(
|
||
|
fontSize: 15.sp,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
),
|
||
|
//未选中文字颜色
|
||
|
unselectedLabelColor: Color(0XFFA29E9E),
|
||
|
indicator: CustomUnderlineTabIndicator(
|
||
|
insets: EdgeInsets.only(top: 10.w, bottom: 2.w),
|
||
|
borderSide: BorderSide(width: 5.w, color: Color(0XFF32A060)),),
|
||
|
indicatorSize: TabBarIndicatorSize.label,
|
||
|
//指示器与文字等宽
|
||
|
tabs: <Widget>[
|
||
|
MyTab(text: S.of(context).haoyou),
|
||
|
MyTab(text: S.of(context).guanzhu),
|
||
|
MyTab(text: S.of(context).fensi),
|
||
|
],
|
||
|
)),
|
||
|
),
|
||
|
Expanded(
|
||
|
child: TabBarView(
|
||
|
controller: tabController,
|
||
|
children: [
|
||
|
FriendGroupList(_allKey[0]),
|
||
|
FriendGroupList(_allKey[1]),
|
||
|
FriendGroupList(_allKey[2]),
|
||
|
],
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|