• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Flutter 게시판 Text다음줄로 변경과 좌측 정렬을 어떻게 하는지 궁금합니다.

Text다음줄로 변경과 좌측 정렬을 어떻게 하는지 궁금합니다.

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #82398

    김윤호
    참가자
    
    안녕하세요
    상품 레이아웃 숙제를 하던 중 궁금증이 생겨 여쭤봅니다.
    1. 위 사진처럼 Text가 화면을 넘어가면 에러가 발생합니다.
    여기서 Text를 자동줄바꿈이나 줄바꿈 할 수 있는 방법은 무엇이 있을까요?
    2. 모든 Text들이 가운데 정렬이 되었습니다. 좌측정렬이 하고 싶을 땐 어떻게 해야될까요?
    3. 그리고 마지막으로 아이콘 1개와 텍스트 우측정렬은 어떻게 해야될까요?
    아래쪽에 코드 첨부해두겠습니다.
    
    import 'package:flutter/material.dart';
    void main(){
      runApp(const MyApp());
    }
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(
              title: Text('금호동3가'),
              actions: const [Icon(Icons.search), Icon(Icons.star), Icon(Icons.star)],
            ),
            body: SizedBox(
              height: 150,
              child: Row(
                children: [
                  Image.asset('logo.png', width: 150,),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: [
                      Text('캐논 DSLR 100D(단렌즈, 충전기 16GB메모리 포함', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 20),),
                      Text('성동구 행당동, 끌올 10분전', style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15, color: Colors.blueGrey),),
                      Text('210,000원', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 20), ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: const [
                          Icon(Icons.heart_broken_sharp),
                          Text('4'),
                        ],
                      ),
                    ],
                  )
                ],
              ),
            ),
          ),
        );
      }
    }
    
    감사합니다.
    #82421

    김윤호
    참가자
    다음화 보고 어느정도 해결되었습니다.
    1. Text오류랑
    3. 우측정렬은 해결하였는데
    
    2번 Text좌측 정렬이 안 됩니다.
    
    import 'package:flutter/material.dart';
    void main(){
      runApp(const MyApp());
    }
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(
              title: Text('금호동3가'),
              actions: const [Icon(Icons.search), Icon(Icons.star), Icon(Icons.star)],
            ),
            body: Container(
              height: 150,
              padding: EdgeInsets.all(3),
              child: Row(
                children: [
                  Flexible(
                    flex: 3,
                    child: SizedBox(
                      child: Image.asset('logo.png'),
                  ),),
                  Flexible(
                    flex: 7,
                    child: SizedBox(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: [
                        Text('캐논 DSLR 100D(단렌즈, 충전기 16GB메모리 포함', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 20),),
                        Text('성동구 행당동, 끌올 10분전', style: TextStyle(fontWeight: FontWeight.w500, fontSize: 15, color: Colors.blueGrey),),
                        Text('210,000원', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 20), ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.end,
                          children: const [
                            Icon(Icons.favorite),
                            Text('4'),
                          ],
                        )
                      ],
                    ),
                  ),),
                ],
              ),
            ),
          ),
        );
      }
    }
    #82490

    codingapple
    키 마스터
    글자를 Align이나 Container로 싸맨 다음에 textAlign 줍시다 
    https://stackoverflow.com/a/51639681
    
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠