admin
2022-05-05 355fe96b2a4c7821256d9e8828d2cb9539904878
flutter_module/lib/ui/mine/add_team.dart
@@ -3,6 +3,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:makemoney/api/http.dart';
import 'package:makemoney/api/team_api.dart';
import 'package:makemoney/model/user/user_info.dart';
import 'package:makemoney/ui/widget/button.dart';
@@ -11,6 +12,7 @@
import 'package:makemoney/utils/ui_utils.dart';
import '../../utils/ui_constant.dart';
import '../../ui/widget/nav.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
import '../../utils/pageutils.dart';
import 'advice_submit.dart';
@@ -39,12 +41,11 @@
class _AddTeamPageState extends State<AddTeamPage>
    with SingleTickerProviderStateMixin {
  final VerificationBoxController _controller = VerificationBoxController();
  final TextEditingController _controller = TextEditingController();
  @override
  void initState() {
    super.initState();
    _controller.text = "123123";
  }
  BoxDecoration getItemDecoration(Color bgColor, Color shadowColor) {
@@ -61,11 +62,16 @@
        ]);
  }
  double? itemWidth;
  @override
  Widget build(BuildContext context) {
    itemWidth = itemWidth ??
        (MediaQuery.of(context).size.width - 60 * 2 - 10 * 5 - 1) / 6;
    return Scaffold(
        resizeToAvoidBottomInset: false,
        backgroundColor: Color(0xFFFFFFFF),
        resizeToAvoidBottomInset: true,
        backgroundColor: const Color(0xFFFFFFFF),
        body: Flex(
          direction: Axis.vertical,
          children: [
@@ -86,15 +92,67 @@
                      TextSpan(text: "金币。"),
                    ]),
                    textAlign: TextAlign.center,
                    style: TextStyle(fontSize: 13, color: ColorConstant.theme),
                    style: TextStyle(
                        fontSize: 13,
                        color: ColorConstant.theme,
                        fontWeight: FontWeight.bold),
                  ),
                  SizedBox(
                  const SizedBox(
                    height: 40,
                  ),
                  Container(
                      alignment: Alignment.center,
                      child: VerificationBox(6, _controller)),
                  SizedBox(
                      child:
                          // VerificationBox(
                          //   6,
                          //   _controller,
                          //   width: MediaQuery.of(context).size.width - 60 * 2,
                          // )
                          PinCodeTextField(
                        appContext: context,
                        length: 6,
                        obscureText: false,
                        animationType: AnimationType.fade,
                        textStyle: const TextStyle(
                            color: ColorConstant.theme,
                            fontSize: 24,
                            fontWeight: FontWeight.bold),
                        cursorColor: ColorConstant.theme,
                        controller: _controller,
                        pinTheme: PinTheme(
                          activeColor: Colors.transparent,
                          selectedColor: Colors.transparent,
                          inactiveColor: Colors.transparent,
                          inactiveFillColor: const Color(0xFFEFEFEF),
                          activeFillColor: const Color(0xFFEFEFEF),
                          selectedFillColor: const Color(0xFFEFEFEF),
                          shape: PinCodeFieldShape.box,
                          borderRadius: BorderRadius.circular(13),
                          fieldHeight: itemWidth! * 1.25,
                          fieldWidth: itemWidth,
                          borderWidth: 0,
                        ),
                        animationDuration: const Duration(milliseconds: 100),
                        backgroundColor: Colors.transparent,
                        enableActiveFill: true,
                        onCompleted: (v) {
                          print("Completed");
                        },
                        onChanged: (value) {
                          print(value);
                          setState(() {
                            // currentText = value;
                          });
                        },
                        beforeTextPaste: (text) {
                          print("Allowing to paste $text");
                          //if you return true then it will show the paste confirmation dialog. Otherwise if false, then nothing will happen.
                          //but you can show anything you want here, like your pop up saying wrong paste format or etc
                          return true;
                        },
                      )),
                  const SizedBox(
                    height: 46,
                  ),
                  MyFillButton(
@@ -103,8 +161,9 @@
                    height: 42,
                    fontSize: 15,
                    onClick: () {
                      print("内容:${_controller.text}");
                      if (_controller.text.length < 6) {
                        return;
                      }
                      TeamApiUtil.getUserByInviteCode(context, _controller.text)
                          .then((value) {
                        if (value == null) {
@@ -188,17 +247,17 @@
                alignment: Alignment.center,
                child: Container(
                    width: dialogWidth,
                    height: 240,
                    height: 350,
                    child: Stack(children: [
                      Container(
                        margin: const EdgeInsets.only(top: 30),
                        margin: const EdgeInsets.only(top: 30, bottom: 110),
                        decoration: const BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(15)),
                            color: Colors.white),
                        alignment: Alignment.topCenter,
                      ),
                      Padding(
                          padding: EdgeInsets.only(left: 10, right: 10),
                          padding: const EdgeInsets.only(left: 10, right: 10),
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.center,
@@ -214,7 +273,7 @@
                                    fontWeight: FontWeight.bold),
                              ),
                              //内容
                              SizedBox(
                              const SizedBox(
                                height: 15,
                              ),
                              const Text(
@@ -224,7 +283,7 @@
                                    fontSize: 18,
                                    fontWeight: FontWeight.bold),
                              ),
                              SizedBox(
                              const SizedBox(
                                height: 35,
                              ),
                              //------按钮区域--------
@@ -248,6 +307,18 @@
                                    }
                                  });
                                },
                              ),
                              const SizedBox(
                                height: 28,
                              ),
                              InkWell(
                                onTap: () {
                                  dismissDialog(context);
                                },
                                child: Image.asset(
                                  "assets/imgs/common/icon_dialog_close.png",
                                  height: 30,
                                ),
                              )
                            ],
                          ))