인프런 - 강의/플루터로 앱 만들기 고고(입문)

17 - My 아이돌 앱 3

----___<<<<< 2020. 4. 28. 01:08

 

import 'package:flutter/material.dart';
import 'package:flutterappasdasdacc11/tabPage.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Drawer"),
      ),
      drawer: Drawer(
        child: ListView(
          children: <Widget>[
            DrawerHeader(
              child: Text(
                "Drawer header",
                style: TextStyle(color:Colors.red),
              ),
              decoration: BoxDecoration(
                color: Colors.blue,
                image: DecorationImage(
                  image: AssetImage('assets/images/1.jpg'),
                  fit:BoxFit.cover
                )
              ),
            ),
            ListTile(
              leading: CircleAvatar(
                backgroundImage: AssetImage('assets/images/1.jpg'),
              ),
              title: Text("아이돌1"),
              onTap : () {
                Navigator.pop(context);
              }
            ),
            ListTile(
              leading: CircleAvatar(
                backgroundImage: AssetImage('assets/images/2.jpg'),
              ),
              title: Text("아이돌2"),
              onTap : () {
                Navigator.pop(context);
              }
            ),
            ListTile(
              leading: CircleAvatar(
                backgroundImage: AssetImage('assets/images/3.jpeg'),
              ),
              title: Text("아이돌3"),
              onTap : () {
                Navigator.pop(context);
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => tabPage())
                );
              }
            ),
            ListTile(
              leading: CircleAvatar(
                backgroundImage: AssetImage('assets/images/4.jpeg'),
              ),
              title: Text("아이돌4"),
              onTap : () {
                Navigator.pop(context);
              }
            ),
          ],
        ),
      ),
      body: Container(
        child: Image.network(
          'https://cdn.pixabay.com/photo/2019/10/28/04/21/puppy-4583450_960_720.jpg'
        ),
      ),
    );
  }
}

 

 

import 'package:flutter/material.dart';

class tabPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("tabPage"),
      ),
      body: Container(
        child: GridView.count(
          crossAxisCount: 3,
          children: <Widget>[
            Container(
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: AssetImage('assets/images/1.jpg'),
                  fit: BoxFit.fill
                )
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/1.jpg'),
                      fit: BoxFit.fill
                  )
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/1.jpg'),
                      fit: BoxFit.fill
                  )
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/2.jpg'),
                      fit: BoxFit.fill
                  )
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/7.jpg'),
                      fit: BoxFit.fill
                  )
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage('assets/images/1.jpg'),
                      fit: BoxFit.fill
                  )
              ),
            ),
          ],
        ),
      ),
    );
  }
}

 

 

 

 

 

 

'인프런 - 강의 > 플루터로 앱 만들기 고고(입문)' 카테고리의 다른 글

19 - Todo App - 2  (0) 2020.05.07
18 - Todo App - 1  (0) 2020.05.07
16 - My 아이돌 앱 2  (0) 2020.04.27
15 - My 아이돌 앱  (0) 2020.04.27
14 - 커플게임 4  (0) 2020.04.24