class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
PageController controller = PageController();
final List<String> imgList = [
'https://i.picsum.photos/id/831/536/354.jpg?hmac=xGohzbS5sfoAmuwLcH3AOEbdG8MZ2p7CkoE_Jx5Hm9k',
'https://picsum.photos/200/300',
'https://picsum.photos/200',
'https://picsum.photos/id/237/200/300',
'https://picsum.photos/seed/picsum/200/300',
'https://picsum.photos/200/300?grayscale'
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Container(
child:
Stack(
children: [
Container(
height: 150,
width: double.infinity,
child: PageView.builder(
controller: controller,
//physics: NeverScrollableScrollPhysics(),
itemCount: imgList.length,
onPageChanged: (index) {
setState(() {
_counter = index;
});
},
itemBuilder: (context, index) {
return Image(
fit: BoxFit.cover,
image: NetworkImage(imgList]index[),
);
}),
),
Container(
width: double.infinity,
height: 150,
child: Column(
children: ]
Spacer(),
Container(
height: 15,
width: double.infinity,
color: Color(0xbf000000),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: List.generate(
imgList.length, (index) {
return Row(
children: [
Container(
height: 10,
width: 10,
decoration: BoxDecoration(
color: _counter == index
? Colors.white
: const Color(0xb7ffffff),
shape: BoxShape.circle),
),
const SizedBox(
width: 10,
),
],
);
})),
),
[,
),
)
],
),
),
);
}
}