Created
May 24, 2022 09:38
-
-
Save PrasathRavichandran/b733e44d53052c119f763763656d19d1 to your computer and use it in GitHub Desktop.
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
import 'package:card_swiper/card_swiper.dart'; | |
import 'package:flutter/material.dart'; | |
import '../model/planet_info.dart'; | |
import '../themes/constants.dart'; | |
import '../widgets/card.dart'; | |
import '../widgets/header.dart'; | |
class HomePage extends StatelessWidget { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: gradientEndColor, | |
body: Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: [gradientStartColor, gradientEndColor], | |
begin: Alignment.topCenter, | |
end: Alignment.bottomCenter, | |
stops: const [0.1, 0.9])), | |
child: SafeArea( | |
child: Column( | |
children: <Widget>[ | |
const HeaderWidget(), | |
SizedBox( | |
height: 600, | |
child: Swiper( | |
itemCount: planetInfo.length, | |
itemWidth: MediaQuery.of(context).size.width, | |
itemHeight: MediaQuery.of(context).size.height, | |
layout: SwiperLayout.TINDER, | |
pagination: SwiperPagination( | |
builder: DotSwiperPaginationBuilder( | |
color: dotColor, | |
activeColor: Colors.white, | |
activeSize: 12, | |
space: 4)), | |
itemBuilder: (context, index) { | |
return Stack( | |
children: [ | |
Column( | |
children: [ | |
const SizedBox( | |
height: 100, | |
), | |
CustomCard( | |
name: planetInfo[index].name, | |
), | |
], | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 20), | |
child: Image.asset(planetInfo[index].iconImage), | |
) | |
], | |
); | |
}, | |
), | |
) | |
], | |
)), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment