커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
에뮬레이터 화면 상 X 자 선 문제
[왕초보] 플러터(Flutter)로 시작하는 앱개발 종합반 v0
2주차
북마크
최*진
댓글
6
추천
0
조회수
12
조회수
12
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


선생님! 안녕하세요

Shazam 앱처럼 클론코딩 중인데

에뮬레이터 상 X 자 선이 나와있어요

저는 코드스니펫이 너무 싫어서 (복붙이 너무 싫어서..)

제가 최대한 하고 있어요 혹시 몰라 코드와 캡쳐화면 모두 올려서 문의드립니다



스파르타 즉문즉답





작성한 코드 및 에러 메세지

import 'package:flutter/material.dart';


void main() {
  runApp(const MyApp());
}


class MyApp extends StatelessWidget {
  const MyApp({super.key});


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}


class HomePage extends StatefulWidget {
  const HomePage({super.key});


  @override
  State<HomePage> createState() => _HomePageState();
}


class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      animationDuration: Duration(milliseconds: 200),
      //initialIndex: 0,
      length: 3,
      child: Scaffold(
          body: Stack(
        children: [
          TabBarView(children: [
            FirstTab(),
            SecondTab(),
            ThirdTab(),
          ]),
          SafeArea(
            child: Column(
              children: [
                Container(
                  alignment: Alignment.topCenter,
                  child: TabPage(),
                ),
              ],
            ),
          ),
        ],
      )),
    );
  }
}


class FirstTab extends StatelessWidget {
  const FirstTab({super.key});


  @override
  Widget build(BuildContext context) {
    const songs = [
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
      {
        'imageUrl': 'https://i.ibb.co/MRSqtP8/autumnnight.jpg',
        'title': '가을밤에 든 생각',
        'artist': '잔나비',
      },
    ];


    return SafeArea(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            //crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: const EdgeInsets.only(
                  left: 20,
                  top: 20,
                ),
                child: Icon(
                  Icons.settings,
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(top: 20),
                child: Text(
                  '라이브러리',
                  style: TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(
                  right: 20,
                  top: 20,
                ),
                child: Icon(Icons.info_outline_rounded),
              ),
            ],
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 30, 20, 5),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                ImageIcon(
                  NetworkImage(
                    "https://i.ibb.co/hxNbZ8p/shazam.png",
                  ),
                  size: 22,
                ),
                SizedBox(
                  width: 10,
                ),
                Text(
                  'Shazam',
                  style: TextStyle(
                    fontSize: 18,
                    letterSpacing: 2,
                    fontWeight: FontWeight.w600,
                  ),
                )
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Divider(),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
            child: Row(
              children: [
                Icon(
                  Icons.person_rounded,
                  size: 22,
                ),
                SizedBox(
                  width: 10,
                ),
                Text(
                  '아티스트',
                  style: TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.w600,
                  ),
                )
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Divider(),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
            child: Row(
              children: [
                Icon(
                  Icons.music_note_rounded,
                  size: 22,
                ),
                SizedBox(
                  width: 10,
                ),
                Text(
                  '회원님을 위한 추천 재생목록',
                  style: TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.w600,
                  ),
                )
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Divider(),
          ),
          Padding(
            padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
            child: Row(
              children: [
                Icon(
                  Icons.list_outlined,
                  size: 22,
                ),
                SizedBox(
                  width: 10,
                ),
                Text(
                  '최근 Shazam',
                  style: TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.w600,
                  ),
                )
              ],
            ),
          ),
          //Row(),
        ],
      ),
    );
  }
}


class SecondTab extends StatelessWidget {
  const SecondTab({super.key});


  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}


class ThirdTab extends StatelessWidget {
  const ThirdTab({super.key});


  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}


class TabPage extends StatelessWidget {
  const TabPage({super.key});


  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴