Skip to content

Commit

Permalink
♻️refactor : #53 userscript createScript 스크린 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
bunju20 committed Apr 10, 2024
1 parent b9a0417 commit f32ce1f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 152 deletions.
34 changes: 18 additions & 16 deletions lib/views/realtime/real_create_script_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,26 @@ class RealCreateScriptPage extends BaseScreen<RealCreateViewModel> {
centerTitle: true,
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Get.back(),
),
),
body: Stack(
children: [
Padding(
onPressed: (){
Get.back();
speechController.clearText();
},
),
),
body: Stack(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(25, 20, 25, 100),
child: Obx(() => TextField(
controller: TextEditingController(text: speechController.text.value),
expands: true,
maxLines: null,
decoration: InputDecoration(
hintText: 'voice_recognition'.tr,
fillColor: Colors.white,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15.0),
controller: TextEditingController(text: speechController.text.value),
expands: true,
maxLines: null,
decoration: InputDecoration(
hintText: 'voice_recognition'.tr,
fillColor: Colors.white,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15.0),
borderSide: BorderSide.none,
),
),
Expand All @@ -55,7 +58,6 @@ class RealCreateScriptPage extends BaseScreen<RealCreateViewModel> {
borderRadius: BorderRadius.circular(40),
onTap: (){
speechController.toggleRecording();
speechController.clearText();
},
child: Padding(
padding: const EdgeInsets.all(20),
Expand Down
26 changes: 23 additions & 3 deletions lib/views/script/create_script_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import 'package:earlips/viewModels/script/create_script_viewmodel.dart';
import 'package:get/get.dart';

class CreateScriptPage extends StatelessWidget {
const CreateScriptPage({super.key});
final String? title; // 선택적으로 제목을 받음
final String? text; // 선택적으로 텍스트를 받음

const CreateScriptPage({super.key, this.title, this.text});


@override
Widget build(BuildContext context) {
Expand All @@ -14,7 +18,7 @@ class CreateScriptPage extends StatelessWidget {
builder: (context, model, child) => Scaffold(
appBar: AppBar(
title: Text(
'home_script_subtitle'.tr,
title ?? 'home_script_subtitle'.tr, // 제목이 제공되면 사용, 아니면 기본값
),
centerTitle: true,
actions: <Widget>[
Expand All @@ -40,7 +44,23 @@ class CreateScriptPage extends StatelessWidget {
flex: 1,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: TextField(
child: text != null
? // 텍스트가 제공되면 이를 사용하여 Container를 구성
Container(
width: Get.width - 40,
margin: const EdgeInsets.all(10.0),
padding: const EdgeInsets.all(20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: Colors.white,
),
child: Text(
text!,
style: const TextStyle(fontSize: 16),
),
)
: // 텍스트가 제공되지 않으면 기본 TextField를 사용
TextField(
controller: model.writedTextController,
expands: true,
maxLines: null,
Expand Down
5 changes: 2 additions & 3 deletions lib/views/script/learning_session_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:earlips/views/script/widget/small_card.dart';
import 'package:earlips/views/script/create_script_screen.dart';
import 'package:earlips/views/script/user_script_screen.dart';
import 'package:earlips/viewModels/script/learning_session_screen_viewmodel.dart';
import 'package:intl/intl.dart'; // DateFormat을 사용하기 위해 추가

Expand Down Expand Up @@ -41,7 +40,7 @@ class _LearningSessionScreenState extends State<LearningSessionScreen> {
appBar: PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight),
child: DefaultBackAppbar(
title: 'live_script_title'.tr,
title: 'home_script_title'.tr,
),
),
body: Obx(() {
Expand Down Expand Up @@ -127,7 +126,7 @@ class _LearningSessionScreenState extends State<LearningSessionScreen> {
),
),
onTap: () {
Get.to(() => UserScriptScreen(
Get.to(() => CreateScriptPage(
title: paragraph.title, text: paragraph.text));
},
),
Expand Down
130 changes: 0 additions & 130 deletions lib/views/script/user_script_screen.dart

This file was deleted.

0 comments on commit f32ce1f

Please sign in to comment.