• flutter 参数传一个范型数据


    可以一个个的传参数进去,也可以整个范型传值进去

    ///窗口模型
    class ChatDialogModel {
      BottleModel bottleModel;
      int type;
    
      ChatDialogModel({required this.bottleModel, required this.type});
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    //范类

    /// app_id : "string"
    /// down_time : 0
    /// down_user_id : 0
    /// drift_bottle_id : 0
    /// level : 0
    /// no_read_num : 0
    /// status : 0
    /// text : "string"
    /// up_time : 0
    /// up_user_id : 0
    
    class BottleModel {
      BottleModel({
        String? appId,
        int?    downTime,
        int?    downUserId,
        int?    driftBottleId,
        int?    level,
        int?    noReadNum,
        int?    status,
        String? text,
        int?    upTime,
        int?    upUserId,
      }) {
        _appId = appId;
        _downTime = downTime;
        _downUserId = downUserId;
        _driftBottleId = driftBottleId;
        _level = level;
        _noReadNum = noReadNum;
        _status = status;
        _text = text;
        _upTime = upTime;
        _upUserId = upUserId;
      }
    
      BottleModel.fromJson(dynamic json) {
        _appId = json['app_id'];
        _downTime = json['down_time'];
        _downUserId = json['down_user_id'];
        _driftBottleId = json['drift_bottle_id'];
        _level = json['level'];
        _noReadNum = json['no_read_num'];
        _status = json['status'];
        _text = json['text'];
        _upTime = json['up_time'];
        _upUserId = json['up_user_id'];
      }
    
      String? _appId;
      int? _downTime;
      int? _downUserId;
      int? _driftBottleId;
      int? _level;
      int? _noReadNum;
      int? _status;
      String? _text;
      int? _upTime;
      int? _upUserId;
    
      BottleModel copyWith({
        String? appId,
        int? downTime,
        int? downUserId,
        int? driftBottleId,
        int? level,
        int? noReadNum,
        int? status,
        String? text,
        int? upTime,
        int? upUserId,
      }) =>
          BottleModel(
            appId: appId ?? _appId,
            downTime: downTime ?? _downTime,
            downUserId: downUserId ?? _downUserId,
            driftBottleId: driftBottleId ?? _driftBottleId,
            level: level ?? _level,
            noReadNum: noReadNum ?? _noReadNum,
            status: status ?? _status,
            text: text ?? _text,
            upTime: upTime ?? _upTime,
            upUserId: upUserId ?? _upUserId,
          );
    
      String? get appId => _appId;
    
      int? get downTime => _downTime;
    
      int? get downUserId => _downUserId;
    
      int? get driftBottleId => _driftBottleId;
    
      int? get level => _level;
    
      int? get noReadNum => _noReadNum;
    
      int? get status => _status;
    
      String? get text => _text;
    
      int? get upTime => _upTime;
    
      int? get upUserId => _upUserId;
    
      Map<String, dynamic> toJson() {
        final map = <String, dynamic>{};
        map['app_id'] = _appId;
        map['down_time'] = _downTime;
        map['down_user_id'] = _downUserId;
        map['drift_bottle_id'] = _driftBottleId;
        map['level'] = _level;
        map['no_read_num'] = _noReadNum;
        map['status'] = _status;
        map['text'] = _text;
        map['up_time'] = _upTime;
        map['up_user_id'] = _upUserId;
        return map;
      }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    ///弹出留言窗口,里面的参数要带上那个范类,required是该数据是必须的
    showChatDialog(context, int state, int index,
        {required ChatDialogModel chatDialogModel}) {
      showModalBottomSheet(
              shape: const RoundedRectangleBorder(
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(24), topRight: Radius.circular(24))),
              isScrollControlled: true,
              enableDrag: false,
              backgroundColor: CommonColors.getColorF5F8F5,
              context: context,
              builder: (context) =>
                  ChatDialog(state, index, chatDialogModel: chatDialogModel))//范型数据传给chatDialog
          .then((value) {
        EventBusUtil.fire(
            OnCloseBottleRefresh(CloudCustomDataBean.TYPE_DRIFT_BOTTLE));
      });
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    ChatDialog里面

    import 'dart:async';
    import 'dart:convert';
    import 'dart:io';
    import 'package:flutter/cupertino.dart';
    import 'package:flutter/material.dart';
    import 'package:oktoast/oktoast.dart';
    import 'package:provider/provider.dart';
    import 'package:social_im/constant/constant.dart';
    import 'package:social_im/logevent/key_events.dart';
    import 'package:social_im/logevent/log_event.dart';
    import 'package:social_im/pages/moment/dialog/playDisposition.dart';
    import 'package:social_im/provider/bottle_provider.dart';
    import 'package:social_im/utils/date_util.dart';
    import '../../../common/Global.dart';
    import '../../../common/avatar.dart';
    import '../../../common/colors.dart';
    import '../../../common/globalEventBus.dart';
    import '../../../generated/l10n.dart';
    import '../../../http/api.dart';
    import '../../../http/net_callback.dart';
    import '../../../http/rxhttp.dart';
    import '../../../http/utils/NetUtils.dart';
    import '../../../http/utils/response.dart';
    import '../../../im/user_info.dart';
    import '../../../models/activity/matchUserBean.dart';
    import '../../../models/cloudCustomDataBean.dart';
    import '../../../router.dart';
    import '../../../utils/image_utile.dart';
    import '../../../utils/loadingUtil.dart';
    import '../../../utils/textfield_util.dart';
    import '../../../widget/user_ex_info.dart';
    import '../../moment/dialog/matchFriendDialog.dart';
    import '../../person/personItemPage/friendFilesPage.dart';
    import '../../widget/myText.dart';
    import '../../widget/splitLine.dart';
    import '../chat_view.dart';
    import '../data/bottle_model.dart';
    import '../data/reply_list.dart';
    import '../data/unlock_user.dart';
    
    ///漂流瓶留言窗口
    class ChatDialog extends StatefulWidget {
      final ChatDialogModel chatDialogModel;
      int state;
      int index;
    
      ChatDialog(this.state, this.index, {Key? key, required this.chatDialogModel})
          : super(key: key);
    
      @override
      State<StatefulWidget> createState() => _ChatDialog();
    }
    
    class _ChatDialog extends State<ChatDialog> with WidgetsBindingObserver {
      final TextEditingController _inputController = TextEditingController();
      final FocusNode _focusNode = FocusNode();
      bool isShowKeyboard = false;
      double keyboardSize = Global.screenHeight * 0.4;
      UnlockUser? _unlockUser;
      ReplyList? replyList;
      late StreamSubscription<MatchDialogEvent> _matchDialogEvent;
    
      @override
      void initState() {
        super.initState();
        _getUnLockUserInfoStatus(widget.chatDialogModel.type == 0
            ? widget.chatDialogModel.bottleModel.upUserId ?? 0
            : widget.chatDialogModel.bottleModel.downUserId ?? 0);//可以在这里直接用了
        WidgetsBinding.instance!.addObserver(this);
        //输入框焦点监测
        _focusNode.addListener(() {
          if (_focusNode.hasFocus) {
            if (MediaQuery.of(context).viewInsets.bottom > 0) {
              isShowKeyboard = true;
            }
          } else {
            isShowKeyboard = false;
          }
          if (mounted) {
            setState(() {});
          }
        });
    
        _getReplyList(
          driftBottleId: widget.chatDialogModel.bottleModel.driftBottleId,
          status: 1,
          pageTime: DateUtil.getNowDateS(),
        );
    
        _matchDialogEvent = EventBusUtil.listen((event) {
          if (event.matchType == 2 && event.playType == PlayDisposition.BOTTLE) {
            unlockUserInfo();
          }
        });
      } //软键盘高度
      
      @override
      Widget build(BuildContext context) {
        return GestureDetector(
            onTap: () {
              setShowBottomView();
            },
            child: Container(
                decoration: BoxDecorationUtil().setFillBoxDecorationImg(
                    'assets/images/match/bg_match_chat.png'),
                height: Global.screenHeight - 140,
                child: Column(mainAxisSize: MainAxisSize.min, children: [
                  addHeadView(),
                  if (widget.index % 3 == 0)
                    Container(
                        width: MediaQuery.of(context).size.width,
                        alignment: Alignment.centerLeft,
                        margin:
                            const EdgeInsets.only(left: 16, right: 16, bottom: 16),
                        padding: const EdgeInsets.only(
                            left: 16, top: 16, bottom: 16, right: 16),
                        decoration: BoxDecoration(
                            color: const Color(0xFFF8F9FF),
                            borderRadius: BorderRadius.circular(12),
                            boxShadow: const [
                              BoxShadow(color: Color(0xFFBCC0EE), blurRadius: 3)
                            ]),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              widget.chatDialogModel.bottleModel.text ?? '',
                              style: const TextStyle(
                                  color: Color(0xFF333333), fontSize: 18),
                            ),
                            Container(
                              margin: EdgeInsets.only(top: 8),
                              child: Text(
                                DateUtil.formatDateMs(
                                    widget.chatDialogModel.bottleModel.downTime! *
                                        1000,
                                    format: 'yyyy.MM.dd'),
                                style: const TextStyle(
                                    color: Color(0xFF999999), fontSize: 12),
                              ),
                            ),
                          ],
                        )),
                  if (widget.index % 3 == 1)
                    Container(
                        width: MediaQuery.of(context).size.width,
                        alignment: Alignment.centerLeft,
                        margin:
                            const EdgeInsets.only(left: 16, right: 16, bottom: 16),
                        padding: const EdgeInsets.only(
                            left: 16, top: 16, bottom: 16, right: 16),
                        decoration: BoxDecoration(
                            color: const Color(0xFFEDFAFF),
                            borderRadius: BorderRadius.circular(12),
                            boxShadow: const [
                              BoxShadow(color: Color(0xFFBCE2F1), blurRadius: 3)
                            ]),
                        child: ContentLeftText(
                            widget.chatDialogModel.bottleModel.text ?? '',
                            14,
                            CommonColors.getColor333333)),
                  if (widget.index % 3 == 2)
                    Container(
                        width: MediaQuery.of(context).size.width,
                        alignment: Alignment.centerLeft,
                        margin:
                            const EdgeInsets.only(left: 16, right: 16, bottom: 16),
                        padding: const EdgeInsets.only(
                            left: 16, top: 16, bottom: 16, right: 16),
                        decoration: BoxDecoration(
                            color: const Color(0xFFFBFFF2),
                            borderRadius: BorderRadius.circular(12),
                            boxShadow: const [
                              BoxShadow(color: Color(0xFFDBEBB6), blurRadius: 3)
                            ]),
                        child: ContentLeftText(
                            widget.chatDialogModel.bottleModel.text ?? '',
                            14,
                            CommonColors.getColor333333)),
                  Expanded(
                      child: ChatView(
                    bottleModel: widget.chatDialogModel.bottleModel,
                  )),
                  Container(
                      margin: EdgeInsets.only(
                          left: 15,
                          right: 15,
                          top: 10,
                          bottom: isShowKeyboard ? keyboardSize : 30),
                      padding: const EdgeInsets.only(left: 16),
                      alignment: Alignment.bottomRight,
                      decoration: BoxDecorationUtil()
                          .setFillBoxDecoration(Colors.white, 14.0),
                      child: Row(
                          mainAxisSize: MainAxisSize.max,
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Expanded(
                                child: TextField(
                                    controller: _inputController,
                                    onSubmitted: (s) {
                                      // onSubmitted(s, context);
                                    },
                                    focusNode: _focusNode,
                                    autocorrect: false,
                                    textAlign: TextAlign.left,
                                    keyboardType: TextInputType.text,
                                    textInputAction: TextInputAction.send,
                                    cursorColor: CommonColors.getThemeColor(),
                                    decoration: const InputDecoration(
                                        border: InputBorder.none,
                                        isCollapsed: true,
                                        isDense: true),
                                    style: const TextStyle(fontSize: 14))),
                            GestureDetector(
                                onTap: () {
                                  String s = _inputController.text.toString();
                                  if (s == '' || s == null) {
                                    return;
                                  }
    
                                  ///todo sendMSG
                                  _sendreply(
                                      widget.chatDialogModel.bottleModel
                                              .driftBottleId ??
                                          0,
                                      widget.state,
                                      s);
                                  _inputController.clear();
                                },
                                child: Container(
                                    padding: const EdgeInsets.only(
                                        top: 12, bottom: 12, right: 19, left: 19),
                                    margin: const EdgeInsets.only(left: 16),
                                    alignment: Alignment.center,
                                    decoration: BoxDecorationUtil()
                                        .setFillBoxDecoration(
                                            CommonColors.getColor27D6BC, 14.0),
                                    child: ContentCenterTextBlod(S.current.send_out,
                                        16.0, Colors.white, FontWeight.normal)))
                          ]))
                ])));
      }
    
      Widget addHeadView() {
        return Container(
            color: Colors.transparent,
            padding: const EdgeInsets.only(top: 16, bottom: 13),
            child: Row(mainAxisSize: MainAxisSize.max, children: [
              GestureDetector(
                  onTap: () {
                    closeView();
                  },
                  child: const Padding(
                      padding: EdgeInsets.only(left: 16, right: 10),
                      child: Image(
                          image: AssetImage('assets/images/icon_back@2x.png'),
                          width: 24,
                          height: 24))),
              if (getAvatar() == "") Spacer(),
              if (getAvatar() != "")
                GestureDetector(
                    onTap: () {},
                    child: Padding(
                        padding: const EdgeInsets.only(right: 8),
                        child: PhysicalModel(
                            shape: BoxShape.circle,
                            color: Colors.transparent,
                            borderRadius: BorderRadius.circular(4.8),
                            clipBehavior: Clip.antiAlias,
                            child: Avatar(
                                width: 36,
                                height: 36,
                                radius: 0,
                                avtarUrl: getAvatar(),
                                svgaAvtarUrl: Global.defUserImag)))),
              if (getSex() != 2 || getBirthday() != -1 || getName() != "")
                Expanded(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                      UserExInfoWidget(
                        nickName: getName(),
                        nickFontSize: 17.0,
                        nickFontColor: CommonColors.getColor1A1A1A,
                      ),
                      Padding(
                          padding: const EdgeInsets.only(top: 2),
                          child: Row(
                              mainAxisSize: MainAxisSize.min,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                    alignment: Alignment.center,
                                    margin: const EdgeInsets.only(right: 6),
                                    padding: const EdgeInsets.fromLTRB(3, 1, 5, 2),
                                    child: Row(
                                        mainAxisSize: MainAxisSize.min,
                                        children: [
                                          Image(
                                              image: AssetImage(getSex() == 1
                                                  ? 'assets/images/icon_gender_male.png'
                                                  : 'assets/images/icon_gender_female.png'),
                                              gaplessPlayback: true,
                                              width: 11,
                                              height: 11),
                                          Padding(
                                              padding:
                                                  const EdgeInsets.only(top: 2),
                                              child: ContentText(
                                                  '${UserInfoUtil().getAge(getBirthday())}',
                                                  9.0,
                                                  Colors.white))
                                        ]),
                                    decoration: BoxDecorationUtil()
                                        .setFillBoxDecoration(
                                            getSex() == 1
                                                ? CommonColors.getColor7E8FF7
                                                : CommonColors.getColorF77EBE,
                                            10.0)),
                                Offstage(
                                    offstage: true,
                                    child: Container(
                                        padding: const EdgeInsets.only(right: 6),
                                        child: ImageUtile.imageWidget(
                                            'assets/images/vip/icon_vip@2x.png',
                                            height: 14)))
                              ]))
                    ])),
              GestureDetector(
                  onTap: () {
                    setShowBottomView();
                    Future.delayed(const Duration(milliseconds: 100), () {
                      if (_unlockUser != null) {
                        showUserInfo();
                      } else {
                        _getUnLockUserInfoStatus(
                            widget.chatDialogModel.type == 0
                                ? widget.chatDialogModel.bottleModel.upUserId ?? 0
                                : widget.chatDialogModel.bottleModel.downUserId ??
                                    0, callBack: () {
                          showUserInfo();
                        });
                      }
                      // showUserInfo(playType);
                    });
                  },
                  child: const Padding(
                      padding: EdgeInsets.only(left: 10, right: 16),
                      child: Image(
                          image: AssetImage(
                              'assets/images/match/icon_match_user_info.png'),
                          width: 32,
                          height: 32)))
            ]));
      }
    
      ///解锁用户信息窗口
      showUserInfo() {
        // if (UserInfoUtil()
        //     .isMyUser('${widget.chatDialogModel.bottleModel.downUserId}')) {
        //   MyRouter.pushMy(context, PersonalFilesPage());
        //   return;
        // }
        // if (_unlockUser?.unlockStatus == 1) {
        //   MyRouter.pushMy(
        //       context,
        //       UserInfoUtil()
        //           .isMyUser('${widget.chatDialogModel.bottleModel.downUserId}')
        //           ? PersonalFilesPage()
        //           : FriendFilesPage(
        //           false, '${widget.chatDialogModel.bottleModel.downUserId}'));
        // }
        if (_unlockUser?.unlockStatus == 1) {
          if (widget.chatDialogModel.type == 0) {
            MyRouter.pushMy(
                context,
                FriendFilesPage(
                    false, '${widget.chatDialogModel.bottleModel.upUserId}'));
          } else if (widget.chatDialogModel.type != 0) {
            MyRouter.pushMy(
                context,
                FriendFilesPage(
                    false, '${widget.chatDialogModel.bottleModel.downUserId}'));
          }
        } else {
          showModalBottomSheet(
              shape: const RoundedRectangleBorder(
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(24), topRight: Radius.circular(24))),
              isScrollControlled: true,
              enableDrag: false,
              backgroundColor: CommonColors.getColorF5F8F5,
              context: context,
              builder: (context) => MatchFriendDialog(
                  2,
                  PlayDisposition.BOTTLE,
                  MatchUserBean(
                      userID: _unlockUser?.userInfo?.userId,
                      nickName: _unlockUser?.userInfo?.nickname,
                      avatar: _unlockUser?.userInfo?.avatar,
                      // avatarThumb:_unlockUser?.userInfo?.avatarThumb,
                      sign: _unlockUser?.userInfo?.sign,
                      sex: _unlockUser?.userInfo?.sex,
                      birthday: _unlockUser?.userInfo?.birthday,
                      vipLevel: _unlockUser?.userInfo?.vipLevel
                      // vipExpirationTime:_unlockUser?.userInfo?.vipExpirationTime
                      )));
        }
      }
    
      setShowBottomView() {
        TextFieldUtil.stowTheKeyboard(context);
      }
    
      closeView() {
        setShowBottomView();
        Future.delayed(const Duration(milliseconds: 100), () {
          Navigator.pop(context);
        });
      }
    }
    
    ///窗口模型
    class ChatDialogModel {
      BottleModel bottleModel;
      int type;
    
      ChatDialogModel({required this.bottleModel, required this.type});
    }
    
    ///弹出留言窗口
    showChatDialog(context, int state, int index,
        {required ChatDialogModel chatDialogModel}) {
      showModalBottomSheet(
              shape: const RoundedRectangleBorder(
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(24), topRight: Radius.circular(24))),
              isScrollControlled: true,
              enableDrag: false,
              backgroundColor: CommonColors.getColorF5F8F5,
              context: context,
              builder: (context) =>
                  ChatDialog(state, index, chatDialogModel: chatDialogModel))
          .then((value) {
        EventBusUtil.fire(
            OnCloseBottleRefresh(CloudCustomDataBean.TYPE_DRIFT_BOTTLE));
      });
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451

    使用方式,调用showChatDialog,传值进去

        Expanded(
                          child: TabBarView(
                              controller: _tabController,
                              children: tabs.map((chose) {
                                switch (chose.position) {
                                  case 0:
                                    return MyThrowBottle(
                                      downList: driftBottleList?.downList ?? [],
                                      onItemClicked: (index) {
                                        showChatDialog(context, 2, index,
                                            chatDialogModel: ChatDialogModel(
                                                type: 0,
                                                bottleModel: driftBottleList
                                                        ?.downList![index] ??
                                                    BottleModel()));
                                      },
                                    );
                                  case 1:
                                    return MyBottle(
                                        upList: driftBottleList?.upList ?? [],
                                        onItemClicked: (index) {
                                          showChatDialog(context, 1, index,
                                              chatDialogModel: ChatDialogModel(
                                                  type: 1,
                                                  bottleModel: driftBottleList
                                                          ?.upList![index] ??
                                                      BottleModel()));
                                        });
                                  default:
                                    return Container();
                                }
                              }).toList()))
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
  • 相关阅读:
    ThreadLocal 源码浅析
    gitlab创建一个项目的流程
    iview实现table里面每行数据的跳转
    c# 同步异步锁
    JAVA IO 流分类整理
    软考中级怎么入户深圳,需要什么条件?
    Ubuntu Linux client L2TP
    并发编程(二)原子性和Synchronized同步锁
    传奇版本添加npc修改增加npc方法以及配置参数教程
    flume系列之:基于zookeeper部署flume agent升级guava和curator版本
  • 原文地址:https://blog.csdn.net/weixin_44911775/article/details/126094483