Skip to content

Instantly share code, notes, and snippets.

@PrasathRavichandran
Created May 24, 2022 09:38
Show Gist options
  • Save PrasathRavichandran/b733e44d53052c119f763763656d19d1 to your computer and use it in GitHub Desktop.
Save PrasathRavichandran/b733e44d53052c119f763763656d19d1 to your computer and use it in GitHub Desktop.
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