mooerView method

Widget mooerView(
  1. AiLogic logic,
  2. bool showPause,
  3. BuildContext context
)

Implementation

Widget mooerView(AiLogic logic, bool showPause, BuildContext context) {
  return AiInputLayout(
      showGlowingFlow: logic.inputController.text.trim().isNotEmpty || showPause,
      slowMode: !showPause,
      child: Row(
        children: [
          Expanded(
            child: Theme(
              data: Theme.of(context).copyWith(
                textSelectionTheme: TextSelectionThemeData(
                  selectionHandleColor: Colors.white,
                  selectionColor: Colors.white.withValues(alpha: 0.5),
                ),
              ),
              child: TextField(
                enabled: !logic.showGridView() ||
                    logic.state == AiPageState.created ||
                    (logic.state == AiPageState.interrupted &&
                        logic.selectResultId != 0 &&
                        logic.tryTaskId == MooerAi.instance.taskId) ||
                    (logic.state == AiPageState.completed &&
                        logic.selectResultId != 0 &&
                        logic.tryTaskId == MooerAi.instance.taskId),
                autofocus: true,
                controller: logic.inputController,
                inputFormatters: inputFormatters,
                decoration: InputDecoration(
                  isDense: true,
                  hintText: logic.selectResultId != 0
                      ? MooerAi.instance.tips["ai_edit_hint"][Get.locale!.languageCode] ?? ""
                      : MooerAi.instance.tips["ai_input_hint"][Get.locale!.languageCode] ?? "",
                  hintStyle: TextStyle(fontSize: 14.sp, color: Colors.white24, fontWeight: FontWeight.w600),
                  border: InputBorder.none,
                ),
                cursorColor: Colors.white70,
                style: TextStyle(fontSize: 14.sp, color: Colors.white, fontWeight: FontWeight.w600),
                onChanged: (value) {
                  logic.update();
                },
              ).marginOnly(left: 15.r),
            ),
          ),
          GestureDetector(
            behavior: HitTestBehavior.opaque,
            onTap: () {
              if (showPause) {
                logic.pause();
              } else {
                logic.send();
              }
            },
            child: Container(
              margin: EdgeInsets.only(right: 6.r),
              width: 35.r,
              height: 35.r,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10),
                color: logic.inputController.text.trim().isEmpty
                    ? Color(0xff3e3f44)
                    : Color(0xff00FFFB).withValues(alpha: 0.2),
              ),
              child: showPause
                  ? AiImage.aiPauseImage
                  : AiImage.aiSendImage(
                      logic.inputController.text.trim().isEmpty ? Colors.white38 : Color(0xff00FFFB)),
            ),
          )
        ],
      ));
}