소스 검색

1.更新注册后放在底部导航栏的我的团队数据不会刷新的问题

tags/0.0.16+7
“yanghuaxuan” 3 년 전
부모
커밋
7a657ccb12
2개의 변경된 파일33개의 추가작업 그리고 24개의 파일을 삭제
  1. +22
    -13
      lib/pages/team_page/team_page.dart
  2. +11
    -11
      lib/widgets/team/appbar/team_app_bar_widget.dart

+ 22
- 13
lib/pages/team_page/team_page.dart 파일 보기

@@ -1,3 +1,6 @@
import 'dart:async';

import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';
@@ -36,22 +39,28 @@ class TeamPage extends StatelessWidget {
],
child: BlocProvider<TeamBloc>(
create: (_) => TeamBloc(repository: TeamRepository())..add(TeamInitEvent(data)),
child: _TeamPageContainer(),
child: _TeamPageContainer(
data: data,
),
),
);
}
}

class _TeamPageContainer extends StatefulWidget {
final Map<String, dynamic> data;

const _TeamPageContainer({Key key, this.data}) : super(key: key);

@override
_TeamPageContainerState createState() => _TeamPageContainerState();
}

class _TeamPageContainerState extends State<_TeamPageContainer> {

TabController _controller;

// TabController 监听
void _tabChangeListener(){
void _tabChangeListener() {
if (!_controller.indexIsChanging) {
Provider.of<TeamPageNotifier>(context, listen: false).updateTabIndex(_controller?.index ?? 0);
}
@@ -80,11 +89,15 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {
);
}

StreamSubscription streamSubscription;

@override
void initState() {
// _controller = TabController(length: tabTitle.length, vsync: ScrollableState());
streamSubscription = EventUtil.instance.on<LoginSuccessEvent>().listen((event) {
BlocProvider.of<TeamBloc>(context).add(TeamInitEvent(widget?.data));
});

super.initState();
}

@@ -97,6 +110,7 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {

@override
void dispose() {
streamSubscription?.cancel();
_controller?.removeListener(_tabChangeListener);
_controller?.dispose();
super.dispose();
@@ -104,9 +118,6 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {

/// 主体视图
Widget _getMainWidget(TeamStyleModel styleModel, TeamDataModel dataModel) {



return Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
@@ -178,22 +189,20 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {
);
}


/// 创建TabBarView
List<Widget> _buildTabBarView(TeamStyleModel styleModel){
List<Widget> _buildTabBarView(TeamStyleModel styleModel) {
List<Widget> lists = [];
int length = styleModel?.userLvTabs?.length ?? 0;
if(length > 0) {
for (int i = 0; i < styleModel.userLvTabs.length; i ++) {
if (length > 0) {
for (int i = 0; i < styleModel.userLvTabs.length; i++) {
UserLvTabs item = styleModel.userLvTabs[i];
lists.add(TeamFansWidget(styleModel, item.type, i));
}
}else{
} else {
lists.add(Container());
}
return lists;
}

}

class _SliverTabBarDelegate extends SliverPersistentHeaderDelegate {


+ 11
- 11
lib/widgets/team/appbar/team_app_bar_widget.dart 파일 보기

@@ -1,27 +1,27 @@

import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class TeamAppBarWidget extends StatelessWidget {

TeamStyleModel model;

TeamAppBarWidget(this.model);

@override
Widget build(BuildContext context) {

return SliverAppBar(
// expandedHeight: 200.0,
brightness: Brightness.light,
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios,
size: 22,
color: HexColor.fromHex('#333333'),
),
onPressed: () => Navigator.maybePop(context),
),
leading: Navigator.canPop(context)
? IconButton(
icon: Icon(
Icons.arrow_back_ios,
size: 22,
color: HexColor.fromHex('#333333'),
),
onPressed: () => Navigator.maybePop(context),
)
: Container(),
backgroundColor: HexColor.fromHex(model?.appBarBgColor ?? '#FFFFFF'),
floating: true,
pinned: true,


불러오는 중...
취소
저장