flammaView method

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

Implementation

Widget flammaView(AiLogic logic, bool showPause, BuildContext context) {

  return Row(
    children: [
      Expanded(
        child: AiFlammaInputLayout(
            showSide: logic.inputController.text.trim().isNotEmpty,
            child: Theme(
              data: Theme.of(context).copyWith(
                textSelectionTheme: TextSelectionThemeData(
                  selectionHandleColor: Colors.white,
                  selectionColor: Colors.white.withValues(alpha: 0.5),
                ),
              ),
              child: Container(
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.only(left: 15.r),
                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: 16.sp, color: Colors.white, fontWeight: FontWeight.w500),
                  onChanged: (value) {
                    logic.update();
                  },
                ),
              ),
            )),
      ),
      GestureDetector(
        behavior: HitTestBehavior.opaque,
        onTap: () {
          if (showPause) {
            logic.pause();
          } else {
            logic.send();
          }
        },
        child: Container(
          margin: EdgeInsets.only(left: 5.r),
          width: 50.r,
          height: 50.r,
          alignment: Alignment.center,
          child: showPause
              ? AiImage.aiPauseImage
              : AiImage.aiFlammaSendImage(
                  logic.inputController.text.trim().isEmpty ? Colors.white54 : Color(0xff2A2A30)),
          decoration: BoxDecoration(
              color:logic.inputController.text.trim().isEmpty? Color(0x1affffff):null,
              gradient: logic.inputController.text.trim().isEmpty? null:LinearGradient(
                  colors: [Color(0xffB5FFFC), Color(0xff44FFF7), Color(0xff0BBAB3)],
                  begin: AlignmentGeometry.topLeft,
                  end: AlignmentGeometry.bottomRight),
              borderRadius: BorderRadius.circular(50.r)),
        ),
      )
    ],
  ).marginSymmetric(
    horizontal: 15.r
  );
}