build method
Describes the part of the user interface represented by this widget.
The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change.
Implementation
@override
Widget build(BuildContext context) {
return AnimatedPositioned(
duration: animationsDuration,
bottom: context.media.viewInsets.bottom + 8,
right: 0,
left: 0,
child: Container(
height: context.width * .1,
width: context.width,
alignment: Alignment.center,
child: PageView.builder(
controller: pageController,
itemCount: fontFamilyList.length,
onPageChanged: onPageChanged,
physics: const BouncingScrollPhysics(),
allowImplicitScrolling: true,
pageSnapping: false,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
onTap(index);
},
child: Container(
height: context.width * .1,
width: context.width * .1,
alignment: Alignment.center,
margin: const EdgeInsets.all(
2,
),
decoration: BoxDecoration(
color: index == selectedFamilyIndex
? Colors.white
: Colors.black.withOpacity(
0.4,
),
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
border: Border.all(
color: Colors.white,
),
),
child: Center(
child: Text(
'Aa',
style: GoogleFonts.getFont(
fontFamilyList[index],
).copyWith(
color: index == selectedFamilyIndex
? Colors.red
: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
);
},
),
),
);
}