Skip to content

Instantly share code, notes, and snippets.

@jeckymodi
Created October 23, 2021 08:31
Show Gist options
  • Save jeckymodi/b3da62a669e65af67d13ac4f41e8d896 to your computer and use it in GitHub Desktop.
Save jeckymodi/b3da62a669e65af67d13ac4f41e8d896 to your computer and use it in GitHub Desktop.
Segment Controll
getSegmentButtons() {
return Consumer<PageNotifier>(builder: (context, provider, snapshot) {
return Padding(
padding: EdgeInsets.only(left: 20, right: 20, top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
getButtonItem("Linked Accounts", selectedIndex == 0, onTap: () {
selectedIndex = 0;
provider.setCurrentPage = selectedIndex.toDouble();
controller.animateToPage(selectedIndex.toInt(),
duration: Duration(milliseconds: 500), curve: Curves.easeIn);
}),
getButtonItem("Delinked Accounts", selectedIndex == 1, onTap: () {
selectedIndex = 1;
provider.setCurrentPage = selectedIndex.toDouble();
controller.animateToPage(selectedIndex.toInt(),
duration: Duration(milliseconds: 500), curve: Curves.easeIn);
}),
],
),
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment