Professional Documents
Culture Documents
EX NO - 2 - Mobile App Development
EX NO - 2 - Mobile App Development
Procedure :
1. Open Vscode -> click (ctrl + shift + `) to open terminal
2. Type flutter create {app name}
3. Open {app name}/ lib/ main.dart
4. Clear all the existing code
5. Write the following
Program :
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("Flutter Card Sample")),
body: const MyCard(),
),
);
}
}
return ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.all(8),
itemCount: phoneNumber.length,
itemBuilder: (BuildContext context, int index) {
return Card(
color: Colors.white,
borderOnForeground: true,
elevation: 10,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
leading: Icon(Icons.call),
title: Text("${phoneNumber[index]}",
style: TextStyle(color: Colors.green)),
subtitle: Text(
"${callType[index]}",
style: TextStyle(color: Colors.orangeAccent),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
child: const Text('Dail'),
onPressed: () {/* ... */},
),
const SizedBox(width: 8),
TextButton(
child: const Text('Call History'),
onPressed: () {/* ... */},
),
],
),
],
),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(),
);
}
}
Output :