Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Antonio, Maurice Rubien C.

BSCS 3-1
Chapter 8 Flutter - Intro to Gestures sample program

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context){
return MaterialApp(
title: 'Maurice Rubien C. Antonio Demo Application',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home:MyHomePage(title: 'Home page'),
);
}
}

class MyHomePage extends StatelessWidget {


MyHomePage({required this.title});

final String title;

void _showDialog(BuildContext context) {


showDialog(context: context, builder: (BuildContext) {
return AlertDialog(
title: new Text("Message"),
content: new Text("Maurice Rubien C. Antonio"),
actions: <Widget>[
new RawMaterialButton(
child: new Text("Close"),
onPressed: () {
Navigator.of(context).pop();
}
)
],
);
},
);
}

@override
Widget build(BuildContext context){
return
Scaffold(
appBar: AppBar(
title: Text(this.title),
),
body: Center(
child: GestureDetector(
onTap:(){
_showDialog(context);
},
Antonio, Maurice Rubien C.
BSCS 3-1
Chapter 8 Flutter - Intro to Gestures sample program
child: Text(
'Maurice Rubien C. Antonio',
),
),
),
);
}
}

Output/s:
Antonio, Maurice Rubien C.
BSCS 3-1
Chapter 8 Flutter - Intro to Gestures sample program

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

You might also like