diff --git a/.gitignore b/.gitignore index 446cd01..d495015 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,8 @@ .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* @@ -491,6 +492,11 @@ __pycache__/ # Tabs Studio *.tss +#Dart Tools +package_config.json +package_config_subset +version + # Telerik's JustMock configuration file *.jmconfig diff --git a/lib/components/cardComponent.dart b/lib/components/cardComponent.dart index 0e3e437..adcb908 100644 --- a/lib/components/cardComponent.dart +++ b/lib/components/cardComponent.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; class CardComponent extends StatelessWidget { - final String title; - final String description; - const CardComponent({super.key, required this.title, required this.description}); + const CardComponent({super.key}); @override Widget build(BuildContext context) { @@ -16,11 +14,6 @@ class CardComponent extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(title, style: const TextStyle(fontSize: 24.0)), - const SizedBox(height: 8.0), - Text(description, style: const TextStyle(fontSize: 16.0)), - ], ), ), ), diff --git a/lib/views/navigation/navigationScreen.dart b/lib/views/navigation/navigationScreen.dart index 9885192..ad91e3c 100644 --- a/lib/views/navigation/navigationScreen.dart +++ b/lib/views/navigation/navigationScreen.dart @@ -11,11 +11,15 @@ class NavigationScreen extends StatefulWidget { class NavigationScreenState extends State { int _selectedIndex = 0; + final _pages = ["Page 1", "Page 2", "Page 3"]; + String _selectedPage = "Page 1"; + final PageController _pageController = PageController(initialPage: 0); void _onItemTapped(int index) { setState(() { _selectedIndex = index; + _selectedPage = _pages[index]; _pageController.animateToPage(index, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); }); @@ -24,11 +28,15 @@ class NavigationScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( + appBar: AppBar( + title: Text(_selectedPage), + ), body: PageView( controller: _pageController, children: _widgetOptions, onPageChanged: (int index) { setState(() { + _selectedPage = _pages[index]; _selectedIndex = index; }); }, @@ -57,30 +65,21 @@ class NavigationScreenState extends State { static final List _widgetOptions = [ Swiper( itemBuilder: (BuildContext context, int index) { - return const CardComponent( - title: 'Page 1', - description: 'This is page 1', - ); + return const CardComponent(); }, itemCount: 1, loop: false, ), Swiper( itemBuilder: (BuildContext context, int index) { - return const CardComponent( - title: 'Page 2', - description: 'This is page 2', - ); + return const CardComponent(); }, itemCount: 1, loop: false, ), Swiper( itemBuilder: (BuildContext context, int index) { - return const CardComponent( - title: 'Page 3', - description: 'This is page 3', - ); + return const CardComponent(); }, itemCount: 1, loop: false,