Skip to content

Instantly share code, notes, and snippets.

@IsmailAlamKhan
Created June 19, 2021 22:28
Show Gist options
  • Save IsmailAlamKhan/a3ed827eccaaae22a1f72c6fba4f2b1d to your computer and use it in GitHub Desktop.
Save IsmailAlamKhan/a3ed827eccaaae22a1f72c6fba4f2b1d to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: const Scaffold(body: Center(child: Home())),
);
}
}
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Button(
// onPreesed: print,
// onPreesed: (value) => print(value),
onPreesed: (value) {
print(value);
},
);
}
}
class Button extends StatelessWidget {
const Button({
Key? key,
required this.onPreesed,
}) : super(key: key);
final ValueChanged<String> onPreesed;
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () => onPreesed('You are gonna die for pressing me'),
child: const Text("Don't press me"),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment