Skip to content

Instantly share code, notes, and snippets.

@triyono777
Last active July 25, 2024 11:43
Show Gist options
  • Save triyono777/954e60139a92184827ab0bfaa290a2f1 to your computer and use it in GitHub Desktop.
Save triyono777/954e60139a92184827ab0bfaa290a2f1 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:projek_satu/counter_screen.dart';
import 'package:projek_satu/home_screen.dart';
class ListScreen extends StatefulWidget {
const ListScreen({Key? key}) : super(key: key);
@override
State<ListScreen> createState() => _ListScreenState();
}
class _ListScreenState extends State<ListScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('List Screen'),
),
body: ListView(
children: [
Card(
child: ListTile(
leading: Icon(Icons.alarm_add),
title: Text('Counter Screen'),
subtitle: Text('ini subtitle'),
trailing: Icon(Icons.arrow_forward),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => CounterScreen(),
),
);
},
),
),
Card(
child: ListTile(
title: Text('Home Screen'),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => HomeScreen(),
),
);
},
)),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (_) => Dialog(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Text('ini dialog'),
),
),
);
},
child: Center(
child: Text(
'Show Dialog',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment