Monday, August 31, 2020

Flutter App: Card using Card Class, Padding, List Tile

 




Flutter App: Card using Container , Row Layout

Container, Row

import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Column(
children: [
CircleAvatar(
radius: 50.0,
backgroundImage: AssetImage('images/sreeraj.jpg'),
),
Text(
'Sreeraj Melath',
style: TextStyle(
fontFamily: 'Pacifico',
fontSize: 40.0,
color: Colors.white,
fontWeight: FontWeight.bold),
),
Text(
'FLUTTER DEVELOPER',
style: TextStyle(
fontFamily: 'SourceSansPro',
fontSize: 20.0,
letterSpacing: 3,
color: Colors.teal[100],
fontWeight: FontWeight.bold),
),
Container(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
padding: EdgeInsets.all(10.0),
child: Row(
children: [
Icon(Icons.phone, color: Colors.teal[900]),
SizedBox(
width: 20.0,
),
Text(
"+91 9846 098 460",
style: TextStyle(
color: Colors.teal[900],
fontFamily: 'SourceSansPro',
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
],
),
),
Container(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
padding: EdgeInsets.all(10.0),
child: Row(
children: [
Icon(
Icons.email,
color: Colors.teal[900],
),
SizedBox(
width: 20.0,
),
Text(
"sreeraj@infoexpo.in",
style: TextStyle(
fontFamily: 'SourceSansPro',
fontSize: 20.0,
color: Colors.teal[900],
fontWeight: FontWeight.bold,
),
)
],
),
)
],
),
),
),
);
}
}

Flutter App : Layout Row , Widget Sections

 


import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 100,
color: Colors.red,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 100,
height: 100,
color: Colors.yellow,
),
Container(
width: 100,
height: 100,
color: Colors.green,
)
],
),
Container(
width: 100,
color: Colors.blue,
),
],
),
),
),
);
}
}

Saturday, August 29, 2020

Flutter App Code: Displaying Asset Image in folder

Right click project folder --> Create images folder --- copy paste the image

Add the asset to the pubspec.yaml


import 'package:flutter/material.dart';

void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
title: Text("National Park"),
backgroundColor: Colors.blueGrey[900],
),
body: Center(
child: Image(image: AssetImage('images/bird.png')),
),
),
),
);
}