ProfileApp - 연습하기

송민경's avatar
Apr 11, 2024
ProfileApp - 연습하기

 
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( home: ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Profile"), ), body: Column( children: [ ], ), ); } }
notion image
 
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( home: ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Profile"), ), body: Column( children: [ Container( color: Colors.yellow, height: 200, ), DefaultTabController( length: 2, child: Column( children: [ TabBar(tabs: [ Tab(icon: Icon(Icons.car_crash)), // test:""는 필수가 아님 Tab(icon: Icon(Icons.car_rental)), ]), ], ), ) ], ), ); } }
notion image
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( home: ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Profile"), ), body: ListView( // Expanded 걸면 무한대로 내려감 children: [ Container( color: Colors.yellow, height: 200, ), DefaultTabController( length: 2, child: Column( children: [ TabBar(tabs: [ Tab(icon: Icon(Icons.car_crash)), // test:""는 필수가 아님 Tab(icon: Icon(Icons.car_rental)), ]), SizedBox( height: 1000, child: TabBarView( // 자기가 사이즈를 못주기에 높이 잡아주기! children: [ Container( color: Colors.red, ), Container( color: Colors.blue, ), ], ), ), ], ), ) ], ), ); } }
notion image
  • 탭바 뷰가 동적으로 늘어나게 하는 것을 앞으로 배울 것
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( home: ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Profile"), ), body: Column( //Expanded 걸면 무한대로 내려감 children: [ Container( color: Colors.yellow, height: 200, ), Expanded( child: DefaultTabController( length: 2, child: Column( children: [ TabBar(tabs: [ Tab(icon: Icon(Icons.car_crash)), // test:""는 필수가 아님 Tab(icon: Icon(Icons.car_rental)), ]), Expanded( child: TabBarView( // 자기가 사이즈를 못주기에 높이 잡아주기! children: [ Container( color: Colors.red, ), Container( color: Colors.blue, ), ], ), ), ], ), ), ) ], ), ); } }
notion image
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: ProfilePage(), ); } } class ProfilePage extends StatelessWidget { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Profile"), ), body: Column( children: [ Container( color: Colors.yellow, height: 200, ), Expanded( child: DefaultTabController( length: 2, initialIndex: 0, child: Column( children: [ TabBar( tabs: [ Tab(icon: Icon(Icons.car_crash)), Tab(icon: Icon(Icons.car_repair)), ], ), Expanded( child: TabBarView( children: [ Container( color: Colors.red, ), GridView.builder( itemCount: 15, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, ), itemBuilder: (context, index) { return Image.network( "https://picsum.photos/id/${index + 1}/200/200"); }, ) ], ), ), ], ), ), ) ], ), ); } }
notion image
Share article

vosw1