Merged with Majd
parent
e20f3b5433
commit
dd524bcbd1
@ -1,46 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:test_sa/new_views/common_widgets/app_bar/custom_app_bar.dart';
|
|
||||||
|
|
||||||
import 'add_floating_button.dart';
|
|
||||||
import 'app_bar/home_app_bar.dart';
|
|
||||||
import 'bottom_nav_bar/home_bottom_nav_bar.dart';
|
|
||||||
|
|
||||||
class TestScreen extends StatefulWidget {
|
|
||||||
static const String id = '/test';
|
|
||||||
const TestScreen({Key key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<TestScreen> createState() => _TestScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TestScreenState extends State<TestScreen> {
|
|
||||||
int screenIndex =0;
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: HomeAppBar(),
|
|
||||||
body: Center(child: _widgetOptions[screenIndex]),
|
|
||||||
floatingActionButton: AddFloatingButton(onPressed: () {},),
|
|
||||||
bottomNavigationBar: HomeBottomNavigationBar(onPressed: (index){
|
|
||||||
setState(() {
|
|
||||||
screenIndex = index;
|
|
||||||
});
|
|
||||||
},),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const List<Widget> _widgetOptions = <Widget>[
|
|
||||||
Text(
|
|
||||||
'Index 0',
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Index 1',
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Index 2',
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Index 3',
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/extensions/int_extensions.dart';
|
||||||
|
|
||||||
|
import 'dashboard_page_indicator.dart';
|
||||||
|
|
||||||
|
class DashboardPage extends StatefulWidget {
|
||||||
|
const DashboardPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DashboardPage> createState() => _DashboardPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DashboardPageState extends State<DashboardPage> {
|
||||||
|
PageController _controller;
|
||||||
|
int _currentPage = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_controller = PageController()
|
||||||
|
..addListener(() {
|
||||||
|
_currentPage = _controller.page.toInt() + 1;
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
DashboardPageIndicator(index: 0, currentPage: _currentPage, controller: _controller),
|
||||||
|
3.width,
|
||||||
|
DashboardPageIndicator(index: 1, currentPage: _currentPage, controller: _controller),
|
||||||
|
3.width,
|
||||||
|
DashboardPageIndicator(index: 2, currentPage: _currentPage, controller: _controller),
|
||||||
|
10.width,
|
||||||
|
Text(
|
||||||
|
"0$_currentPage/03",
|
||||||
|
style: Theme.of(context).textTheme.labelMedium?.copyWith(fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
8.height,
|
||||||
|
Expanded(
|
||||||
|
child: PageView(
|
||||||
|
controller: _controller,
|
||||||
|
children: const [
|
||||||
|
Center(
|
||||||
|
child: Text('First Page'),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Text('Second Page'),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Text('Third Page'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue