Last active
February 4, 2020 19:11
-
-
Save ybakos/05d5ee25c7c6d3ecb8a687d325950d33 to your computer and use it in GitHub Desktop.
CS 492 Week 6 Exploration 2.2 Exercise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(App()); | |
| class App extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: false, | |
| home: Scaffold( | |
| body: MainTabController() | |
| ), | |
| ); | |
| } | |
| } | |
| class MainTabController extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return DefaultTabController( | |
| length: 3, | |
| initialIndex: 0, | |
| child: Scaffold( | |
| appBar: AppBar( | |
| title: Text('Exercise'), | |
| bottom: TabBar(tabs: []) //FIXME: Need a list of Tab objects. | |
| ), | |
| body: TabBarView( | |
| children: [] // FIXME: Need a list of 'screen' widgets. | |
| ) | |
| ) | |
| ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(App()); | |
| class App extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: false, | |
| home: Scaffold( | |
| body: MainTabController() | |
| ), | |
| ); | |
| } | |
| } | |
| class MainTabController extends StatelessWidget { | |
| static const tabs = [ | |
| Tab(text: 'Love'), | |
| Tab(text: 'Health'), | |
| Tab(text: 'Travel') | |
| ]; | |
| final screens = [ | |
| LoveScreen(), | |
| HealthScreen(), | |
| TravelScreen(), | |
| ]; | |
| @override | |
| Widget build(BuildContext context) { | |
| return DefaultTabController( | |
| length: 3, | |
| initialIndex: 0, | |
| child: Scaffold( | |
| appBar: AppBar( | |
| title: Text('Exercise'), | |
| bottom: TabBar(tabs: tabs) | |
| ), | |
| body: TabBarView(children: screens) | |
| ) | |
| ); | |
| } | |
| } | |
| class LoveScreen extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Center(child: Text('Love Screen')); | |
| } | |
| } | |
| class HealthScreen extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Center(child: Text('Health Screen')); | |
| } | |
| } | |
| class TravelScreen extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Center(child: Text('Travel Screen')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment