커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
2주차 숙제
앱개발 종합반 - 플러터 v8
0주차
북마크
김*윤
댓글
5
추천
0
조회수
17
조회수
17
답변 완료

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

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


background를 전부 채울 수 있는 방법을 찾지 못했습니다ㅜ..ㅜ

그리고 appbar와 body 배경색을 다르게 넣는 방법 말고 한번에 그라데이션으로 넣을 수 있는 방법도 알고 싶습니다..!





스파르타 즉문즉답






import 'package:flutter/material.dart';
import 'package:shazam/thirdtap.dart';


import 'firsttap.dart';


class SecondTab extends StatelessWidget {
  const SecondTab({Key? key}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0,
        leadingWidth: 100,
        leading: GestureDetector(
          onTap: () {
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => FirstTab()),
            );
          },
          child: Padding(
            padding: EdgeInsets.only(left: 7),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Icon(Icons.person),
                Text(
                  '라이브러리',
                  style: TextStyle(color: Colors.white, fontSize: 15),
                  textAlign: TextAlign.center,
                ),
              ],
            ),
          ),
        ),
        actions: [
          GestureDetector(
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => ThirdTab()),
              );
            },
            child: Padding(
              padding: EdgeInsets.only(right: 20),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(Icons.show_chart),
                  Text(
                    '차트',
                    style: TextStyle(color: Colors.white, fontSize: 15),
                    textAlign: TextAlign.center,
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
      body: SafeArea(
          child: Container(
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.topLeft, // 그라데이션 시작 위치
                  end: Alignment.bottomRight, // 그라데이션 종료 위치
                  colors: [
                    Color.fromARGB(255, 39, 183, 250),
                    Color.fromARGB(255, 17, 92, 153)
                  ], // 그라데이션에 사용할 색상 목록
                  // stops: [0.0, 1.0], // 각 색상의 위치 (선택적)
                  // tileMode: TileMode.repeated, // 그라데이션 반복 모드 (선택적)
                ),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  SizedBox(height: MediaQuery.of(context).size.height * 0.1),
                  Text(
                    'Shazam하려면 탭하세요',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 24,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(height: MediaQuery.of(context).size.height * 0.06),
                  Container(
                    alignment: Alignment.center,
                    height: 200,
                    width: 200,
                    decoration: BoxDecoration(
                      color: Colors.blue,
                      shape: BoxShape.circle,
                    ),
                    child: Image.network(
                      "https://i.ibb.co/hxNbZ8p/shazam.png",
                      color: Colors.white,
                      width: 130,
                      height: 130,
                    ),
                  ),
                  SizedBox(height: MediaQuery.of(context).size.height * 0.12),
                  Container(
                    width: 50,
                    height: 50,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                      color: Colors.blue[400],
                      shape: BoxShape.circle,
                    ),
                    child: Icon(
                      Icons.search,
                      color: Colors.white,
                      size: 30,
                    ),
                  )
                ],
              )
              // ... 다른 위젯 추가
            ),
          ),
         );
        }
      }


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