Skip to content

Instantly share code, notes, and snippets.

@rubywai
Created May 2, 2023 14:29
Show Gist options
  • Select an option

  • Save rubywai/12fe95056ffaf6f01d16b95256003cd3 to your computer and use it in GitHub Desktop.

Select an option

Save rubywai/12fe95056ffaf6f01d16b95256003cd3 to your computer and use it in GitHub Desktop.
//debug release profile
//assets file binary network
//container
// Material , Cupertino
//Stateless .Stateful
import 'dart:developer';
import 'package:flutter/material.dart';
//asset file network memory
void main() {
runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: Home()));
}
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Buttons'),
),
body: Center(
child: Column(
children: [
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.indigo,
foregroundColor: Colors.yellow,
shadowColor: Colors.green,
),
onPressed: click,
onLongPress: (){
showSnackBar(context);
},
icon: const Icon(Icons.alarm,color: Colors.white,),
label: const Text('Alarm'),),
TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.indigo,
shadowColor: Colors.black
),
onPressed: (){
showSnackBar(context);
}, child: const Text('Text Button')),
OutlinedButton(
style: OutlinedButton.styleFrom(
foregroundColor: Colors.indigo,
side: BorderSide(color: Colors.red,width: 3)
),
onPressed: (){
showSnackBar(context);
}, child: const Text('Oulined Button')),
IconButton(
color: Colors.blue,
tooltip: 'Notification',
onPressed: (){
}, icon: Icon(Icons.notifications)),
FloatingActionButton(
child: Icon(Icons.notifications),
onPressed: (){
showSnackBar(context);
})
],
),
),
);
}
void click(){
debugPrint('I am clicking the button');
}
void showSnackBar(BuildContext context){
ScaffoldMessenger.of(context)
.showSnackBar(const
SnackBar(
content: Text('You are pressing the button'),
backgroundColor: Colors.indigo,
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment