0% found this document useful (0 votes)
14 views5 pages

Mobile Prog

Uploaded by

prashikkadam52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Mobile Prog

Uploaded by

prashikkadam52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Mobile Programming Practicals

Practical 1: Installation and setup

Requirements:
1. Android Studio (for android sdk and command line tools)
2. VS Code (Flutter Extension)
3. Flutter SDK (link)

Add Flutter SDK/bin folder to Environment Variables.

Practical 2: Flutter App with Widgets

in cmd:
flutter pub add table_calendar

main.dart
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';

import 'pages/basics_example.dart';
import 'pages/complex_example.dart';
import 'pages/events_example.dart';
import 'pages/multi_example.dart';
import 'pages/range_example.dart';

void main() {
initializeDateFormatting().then((_) => runApp(MyApp()));
}

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TableCalendar Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: StartPage(),
);
}
}

class StartPage extends StatefulWidget {


@override
_StartPageState createState() => _StartPageState();
}

class _StartPageState extends State<StartPage> {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('TableCalendar Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 20.0),
ElevatedButton(
child: Text('Basics'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableBasicsExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Range Selection'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableRangeExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Events'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableEventsExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Multiple Selection'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableMultiExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Complex'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableComplexExample()),
),
),
const SizedBox(height: 20.0),
],
),
),
);
}
}

Practical 3: Flutter app with layouts

main.dart
// Copyright 2019 Aleksander Woźniak
// SPDX-License-Identifier: Apache-2.0

import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';

import 'pages/basics_example.dart';
import 'pages/complex_example.dart';
import 'pages/events_example.dart';
import 'pages/multi_example.dart';
import 'pages/range_example.dart';

void main() {
initializeDateFormatting().then((_) => runApp(MyApp()));
}

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TableCalendar Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: StartPage(),
);
}
}

class StartPage extends StatefulWidget {


@override
_StartPageState createState() => _StartPageState();
}

class _StartPageState extends State<StartPage> {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('TableCalendar Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 20.0),
ElevatedButton(
child: Text('Basics'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableBasicsExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Range Selection'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableRangeExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Events'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableEventsExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Multiple Selection'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableMultiExample()),
),
),
const SizedBox(height: 12.0),
ElevatedButton(
child: Text('Complex'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => TableComplexExample()),
),
),
const SizedBox(height: 20.0),
],
),
),
);
}
}

pubspec.yaml

add >

flutter:
uses-material-design: true
assets:
- images/lake.jpg

You might also like