sergiandreplace / flutter_planets_tutorial Goto Github PK
View Code? Open in Web Editor NEWThe Flutter Planets app tutorial with commits per lesson
License: Apache License 2.0
The Flutter Planets app tutorial with commits per lesson
License: Apache License 2.0
`import 'package:flutter/material.dart';
import 'package:my_flutter_plannets/model/planets.dart';
class PlanetRow extends StatelessWidget {
final Planet planet;
PlanetRow(this.planet);
@OverRide
Widget build(BuildContext context) {
final planetThumbnail = new Container(
margin: new EdgeInsets.symmetric(
vertical: 16.0
),
alignment: FractionalOffset.centerLeft,
child: new Image(
image: new AssetImage(planet.image),
height: 92.0,
width: 92.0,
),
);
final baseTextStyle = const TextStyle(
fontFamily: 'Poppins'
);
final regularTextStyle = baseTextStyle.copyWith(
color: const Color(0xffb6b2df),
fontSize: 9.0,
fontWeight: FontWeight.w400
);
final subHeaderTextStyle = regularTextStyle.copyWith(
fontSize: 12.0
);
final headerTextStyle = baseTextStyle.copyWith(
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.w600
);
Widget _planetValue({String value, String image}) {
return new Row(
children: <Widget>[
new Image.asset(image, height: 12.0),
new Container(width: 8.0),
new Text(planet.gravity, style: regularTextStyle),
]
);
}
final planetCardContent = new Container(
margin: new EdgeInsets.fromLTRB(76.0, 16.0, 16.0, 16.0),
constraints: new BoxConstraints.expand(),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Container(height: 4.0),
new Text(planet.name, style: headerTextStyle),
new Container(height: 10.0),
new Text(planet.location, style: subHeaderTextStyle),
new Container(
margin: new EdgeInsets.symmetric(vertical: 8.0),
height: 2.0,
width: 18.0,
color: new Color(0xff00c6ff)
),
new Row(
children: <Widget>[
new Expanded(
child: _planetValue(
value: planet.distance,
image: 'assets/img/ic_distance.png')
),
new Expanded(
child: _planetValue(
value: planet.gravity,
image: 'assets/img/ic_gravity.png')
)
],
),
],
),
);
final planetCard = new Container(
child: planetCardContent,
height: 124.0,
margin: new EdgeInsets.only(left: 46.0),
decoration: new BoxDecoration(
color: new Color(0xFF333366),
shape: BoxShape.rectangle,
borderRadius: new BorderRadius.circular(8.0),
boxShadow: <BoxShadow>[
new BoxShadow(
color: Colors.black12,
blurRadius: 10.0,
offset: new Offset(0.0, 10.0),
),
],
),
);
return new Container(
height: 120.0,
margin: const EdgeInsets.symmetric(
vertical: 16.0,
horizontal: 24.0,
),
child: new Stack(
children: <Widget>[
planetCard,
planetThumbnail,
],
)
);
hi, bro
I was confused that the hight of planetRow is 120.0 ,less than the hight of planetCard 124.0, but the planetCard is child of planetRow ,what means here? what hight show in reality ? I provide that 120.0 show in reality, what influence of the hight of planetRow? looking forward your response ,thank u!
I am newbie so sorry for any inconvenience ..
I just cloned the project to my PC, and opened it with Android Studio ..
It showed an error regarding the path for Dart and Flutter SDK .. I provided the path.
But every time I try to run the app it's getting stuck in Initializing gradle and nothing happening.
Install new version of Flutter, then:
git clone https://github.com/sergiandreplace/flutter_planets_tutorial.git flutter_planets_tutorial2
flutter create flutter_planets_tutorial
copy ./flutter_planets_tutorial2/lib ./flutter_planets_tutorial/lib
copy ./flutter_planets_tutorial2/assets ./flutter_planets_tutorial/assets
cd /flutter_planets_tutorial/
flutter run
other way, I did not get gradle
to work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.