This file contains 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
onChanged: (text) { | |
if (text.length != 0) { | |
// when input new text, make next TextField get focus | |
FocusScope.of(context).requestFocus(nextFocusNode); | |
} else { | |
// when remove text from TextField, make previous TextField get focus | |
FocusScope.of(context).requestFocus(previousFocusNode); | |
} | |
if (nextFocusNode == null) { |
This file contains 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
@override | |
build(BuildContext context) { | |
return Stack( | |
children: <Widget>[ | |
// transparent black background | |
Container( | |
height: this.getHeight(), | |
color: Color.fromRGBO(0, 0, 0, 0.6), | |
), |
This file contains 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
Widget _getItems() { | |
return Container( | |
child: ListView.builder( | |
itemCount: this.dotCount, | |
scrollDirection: Axis.horizontal, | |
itemBuilder: (context, index) { | |
return _renderItem(index); | |
}, | |
), | |
width: this.getWidth(), |
This file contains 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
double getWidth() { | |
return dotSize * dotCount + this.dotPadding * (dotCount + 5); | |
} | |
double getHeight() { | |
return dotSize + dotPadding * 2; | |
} |
This file contains 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
Widget _renderItem(int index) { | |
var color = | |
this.currentIndex == index ? this.dotColor : this.dotSelectedColor; | |
return GestureDetector( | |
child: Padding( | |
padding: EdgeInsets.all(this.dotPadding), | |
child: Container( | |
width: this.dotSize, | |
height: this.dotSize, | |
decoration: BoxDecoration( |
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: Stack( | |
children: <Widget>[ | |
Container( | |
child: pageView, | |
), | |
Positioned( | |
child: _getIndicator(), |
This file contains 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
Widget _getIndicator() { | |
return Code4Indicator( | |
dotCount: this.widget.imagePaths.length, | |
currentIndex: currentIndex, | |
dotColor: Color.fromRGBO(255, 255, 255, 1), | |
dotSelectedColor: Color.fromRGBO(255, 255, 255, 0.3), | |
dotPadding: 12, | |
dotSize: 14, | |
onItemTap: (index) { | |
pageController.jumpToPage(index); |
This file contains 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
Widget _getPageView() { | |
return pageView = PageView.builder( | |
itemCount: this.widget.imagePaths.length, | |
itemBuilder: (BuildContext context, int index) { | |
return Image( | |
image: AssetImage(this.widget.imagePaths[index]), | |
fit: BoxFit.cover, | |
); | |
}, | |
onPageChanged: (index) { |
This file contains 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
Widget _buildTextContainer() { | |
var titleContainer = Text( | |
this.trip.title, | |
style: TextStyle( | |
color: Colors.white, | |
fontWeight: FontWeight.bold, | |
letterSpacing: 1.0, | |
fontSize: 14, | |
), | |
); |
This file contains 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
var imageOverlayGradient = DecoratedBox( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
begin: FractionalOffset.topCenter, | |
end: FractionalOffset.bottomCenter, | |
colors: [ | |
Color.fromRGBO(0, 0, 0, 0), | |
Color.fromRGBO(0, 0, 0, 0.8), | |
], | |
), |