Created
May 24, 2022 11:43
-
-
Save PrasathRavichandran/ee8b8aa8517aa460400b855b23f952db to your computer and use it in GitHub Desktop.
This file contains hidden or 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:flutter/material.dart'; | |
import 'package:universe_minimal_ui/model/planet_info.dart'; | |
import 'package:universe_minimal_ui/themes/constants.dart'; | |
class DetailsPage extends StatelessWidget { | |
final PlanetInfo planetInfo; | |
const DetailsPage({Key? key, required this.planetInfo}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SafeArea( | |
bottom: false, | |
child: Stack( | |
children: [ | |
SingleChildScrollView( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(32.0), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
const SizedBox( | |
height: 300, | |
), | |
Text( | |
planetInfo.name, | |
style: TextStyle( | |
fontSize: 56, | |
fontWeight: FontWeight.w900, | |
color: primaryTextColor, | |
fontFamily: 'Avenir'), | |
textAlign: TextAlign.left, | |
), | |
Text( | |
'Solar System', | |
style: TextStyle( | |
fontSize: 36, | |
fontWeight: FontWeight.w300, | |
color: primaryTextColor, | |
fontFamily: 'Avenir'), | |
textAlign: TextAlign.left, | |
), | |
const Divider( | |
color: Colors.black38, | |
), | |
const SizedBox( | |
height: 12, | |
), | |
Text( | |
planetInfo.description, | |
maxLines: 5, | |
overflow: TextOverflow.ellipsis, | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w500, | |
color: contentTextColor, | |
fontFamily: 'Avenir'), | |
textAlign: TextAlign.left, | |
), | |
const SizedBox( | |
height: 12, | |
), | |
const Divider( | |
color: Colors.black38, | |
), | |
], | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 32.0, bottom: 10), | |
child: Text( | |
'Gallery', | |
style: TextStyle( | |
fontSize: 26, | |
fontWeight: FontWeight.w600, | |
color: contentTextColor, | |
fontFamily: 'Avenir'), | |
textAlign: TextAlign.left, | |
), | |
), | |
SizedBox( | |
height: 250, | |
child: Padding( | |
padding: const EdgeInsets.only(left: 30.0), | |
child: ListView.builder( | |
itemCount: planetInfo.images.length, | |
scrollDirection: Axis.horizontal, | |
itemBuilder: (context, index) { | |
return Card( | |
clipBehavior: Clip.antiAlias, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(32)), | |
child: AspectRatio( | |
aspectRatio: 1, | |
child: Image.network( | |
planetInfo.images[index], | |
fit: BoxFit.cover, | |
)), | |
); | |
}, | |
), | |
), | |
) | |
], | |
), | |
), | |
Positioned( | |
right: -64, | |
child: Image.asset(planetInfo.iconImage)), | |
Positioned( | |
left: 32, | |
top: 60, | |
child: Text( | |
planetInfo.position.toString(), | |
style: TextStyle( | |
fontSize: 247, | |
color: primaryTextColor.withOpacity(0.08), | |
fontWeight: FontWeight.w900, | |
fontFamily: 'Avenir'), | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 10.0, top: 10.0), | |
child: IconButton( | |
onPressed: () { | |
Navigator.pop(context); | |
}, | |
icon: const Icon(Icons.arrow_back_ios)), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment