3 글 보임 - 1 에서 3 까지 (총 3 중에서)
-
글쓴이글
-
2023년 5월 10일 16:36 #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'), ], ),
], ) ], ), ), ),
); } } 감사합니다.
2023년 5월 10일 17:13 #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'), ], ) ], ), ),), ], ), ), ),
); } }
2023년 5월 10일 19:52 #82490
codingapple키 마스터글자를 Align이나 Container로 싸맨 다음에 textAlign 줍시다 https://stackoverflow.com/a/51639681
-
글쓴이글
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
- 답변은 로그인 후 가능합니다.