|
- import 'package:chat/data/chat_data_mgr.dart';
- import 'package:chat/data/constants.dart';
- import 'package:chat/data/group_data_mgr.dart';
- import 'package:chat/generated/i18n.dart';
- import 'package:chat/home/group_item_widget.dart';
- import 'package:chat/home/last_chat_record_widget.dart';
- import 'package:chat/models/group_info_model.dart';
- import 'package:chat/utils/receive_share_file.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
-
- import 'CustomUI.dart';
-
- class FileTransferPage extends StatefulWidget {
- final String filePath;
- FileTransferPage(this.filePath);
-
- @override
- State<StatefulWidget> createState() {
-
- return FileTransferPageState();
- }
- }
-
- class FileTransferPageState extends State<FileTransferPage>
- with SingleTickerProviderStateMixin {
- ScrollController _scrollController = ScrollController();
-
- List<GroupInfoModel> groupList = [];
- var lastMsgList = ChatDataMgr().lastMsgProvider.lastMsgList;
-
- TabController tabCtrl;
-
- @override
- void initState() {
- super.initState();
-
- tabCtrl = TabController(length: 2, vsync: this);
- groupList = GroupInfoMgr().groupInfoList;
- if (groupList.length == 0) {
- Future.delayed(Duration(seconds: 3), () {
- setState(() {
- groupList = GroupInfoMgr().groupInfoList;
- });
- });
- }
- }
-
- @override
- Widget build(BuildContext context) {
- Widget appBar = new AppBar(
- backgroundColor: AppColors.NewAppbarBgColor,
- title: new Text(
- '发送给',//I18n.of(context).send_to,
- style: TextStyle(color: AppColors.NewAppbarTextColor),
- textScaleFactor: 1.0,
- ),
- leading: CustomUI.buildCustomLeading(context),
- centerTitle: true,
- bottom: PreferredSize(
- preferredSize: Size.fromHeight(28),
- child: Container(
- padding: EdgeInsets.only(left: 2),
- decoration: BoxDecoration(
- color: Constants.LightGreyBackgroundColor,
- border: Border(bottom: BorderSide(color: Color(0xffeaeaea)))),
- alignment: Alignment.centerLeft,
- child: TabBar(
- isScrollable: true,
- indicatorPadding: EdgeInsets.only(left: 9, right: 9),
- tabs: <Widget>[
- Container(
- margin: EdgeInsets.only(right: 4),
- child:
- Text(I18n.of(context).text_chat, textScaleFactor: 1.0),
- ),
- Container(
- margin: EdgeInsets.only(right: 4),
- child: Text(I18n.of(context).group_chat,
- textScaleFactor: 1.0)),
- ],
- controller: tabCtrl,
- ),
- )));
-
- return Material(
- child: SafeArea(
- child: Scaffold(
- appBar: appBar,
- body: TabBarView(
- children: <Widget>[
- LastChatPage(
- needRobot: false,
- enterType: 1,
- enterContent: widget.filePath,
- ),
-
- ///群聊
- groupList.length == 0
- ? Container()
- : Container(
- child: ListView.builder(
- controller: _scrollController,
- itemBuilder: (BuildContext context, int index) {
- var info = groupList[index];
- return GroupItem(
- ValueKey(info),
- groupInfoModel: info,
- enterType: 1,
- enterContent: widget.filePath,
- );
- },
- itemCount: groupList.length,
- ))
- ],
- controller: tabCtrl,
- ),
- ),
- ),
- );
-
- // return SafeArea(child: Scaffold(body: FileReaderView(
- // filePath: widget.filePath,
- // ),));
- }
-
- @override
- void dispose() {
-
- super.dispose();
- ReceiveShareFile.tempFilePath = null;
- tabCtrl.dispose();
- }
- }
|