File tree Expand file tree Collapse file tree 4 files changed +65
-4
lines changed Expand file tree Collapse file tree 4 files changed +65
-4
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ class _MainState extends State<MainPage> {
6161 "Ink" ,
6262 "RichText" ,
6363 "Progress" ,
64+ "Segment" ,
6465 ];
6566 return _sortTitles;
6667 }
@@ -82,6 +83,7 @@ class _MainState extends State<MainPage> {
8283 "/InkPage" ,
8384 "/RichTextPage" ,
8485 "/MainProgressPage" ,
86+ "/SegmentPage" ,
8587 ];
8688 return _sortRouteNames;
8789 }
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import 'sample/clip/clip_main_page.dart';
3434import 'sample/navigation/curved_navigation_bar_page.dart' ;
3535import 'sample/picker/main_picker_page.dart' ;
3636import 'sample/progress/main_progress_page.dart' ;
37+ import 'sample/segment/segment_page.dart' ;
3738import 'sample/text/RichTextPage.dart' ;
3839import 'sample/tip/flushbar_page.dart' ;
3940import 'sample/user/user_info_page.dart' ;
@@ -116,6 +117,7 @@ class Test extends StatelessWidget {
116117 "/InkPage" : (_) => InkPage (),
117118 "/RichTextPage" : (_) => RichTextPage (),
118119 "/MainProgressPage" : (_) => MainProgressPage (),
120+ "/SegmentPage" : (_) => SegmentPage (),
119121 },
120122 );
121123 },
Original file line number Diff line number Diff line change 11import 'package:airoute/airoute.dart' ;
2+ import 'package:flutter/cupertino.dart' ;
23import 'package:flutter/material.dart' ;
34
45import '../../common/helper/tip_helper.dart' ;
56import '../../common/helper/tip_type.dart' ;
6- import '../../common/util/ToastUtil.dart' ;
77
88///
99/// AnimOfSwitchPage
@@ -90,9 +90,7 @@ class _AnimOfSwitchState extends State<AnimOfSwitchPage> {
9090 index: _tabSelectedIndex,
9191 children: < Widget > [
9292 Column (
93- /*
94- 选择,动画类型
95- */
93+ //选择,动画类型
9694 children: < Widget > [
9795 Placeholder (
9896 strokeWidth: 0 ,
Original file line number Diff line number Diff line change 1+ import 'package:flutter/cupertino.dart' ;
2+ import 'package:flutter/material.dart' ;
3+
4+ ///
5+ /// SegmentPage
6+ class SegmentPage extends StatefulWidget {
7+ @override
8+ State <StatefulWidget > createState () {
9+ return _SegmentState ();
10+ }
11+ }
12+
13+ ///
14+ /// _SegmentState
15+ class _SegmentState extends State <SegmentPage > {
16+ final Map <int , Widget > _segmentChildren = const {
17+ 0 : Text ('Child 1' ),
18+ 1 : Text ('Child 2' ),
19+ 2 : Text ('Child 3' ),
20+ 3 : Text ('Child 4' ),
21+ 4 : Text ('Child 5' ),
22+ 5 : Text ('Child 6' ),
23+ };
24+ int _currentValue = 0 ;
25+
26+ @override
27+ Widget build (BuildContext context) {
28+ return Scaffold (
29+ appBar: AppBar (
30+ title: Text ("Segment" ),
31+ ),
32+ body: Column (
33+ children: < Widget > [
34+ CupertinoSegmentedControl <int >(
35+ children: _segmentChildren,
36+ onValueChanged: (int newValue) {
37+ setState (() {
38+ _currentValue = newValue;
39+ });
40+ },
41+ padding: EdgeInsets .all (15 ),
42+ groupValue: _currentValue,
43+ ),
44+ CupertinoSlidingSegmentedControl <int >(
45+ children: _segmentChildren,
46+ onValueChanged: (int newValue) {
47+ setState (() {
48+ _currentValue = newValue;
49+ });
50+ },
51+ padding: EdgeInsets .all (15 ),
52+ groupValue: _currentValue,
53+ ),
54+ Spacer (),
55+ ],
56+ ),
57+ );
58+ }
59+ }
You can’t perform that action at this time.
0 commit comments