Last active
November 3, 2022 19:26
-
-
Save leighajarett/b776dfe43c91e580c66b2b93368745eb to your computer and use it in GitHub Desktop.
Flutter Text Button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoApp( | |
home: const HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: | |
// #docregion textbutton | |
CupertinoButton( | |
onPressed: () { | |
// this closure gets called when your button is tapped | |
}, | |
child: const Text('Do something'), | |
) | |
// #enddocregion textbutton | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment