Skip to content

Instantly share code, notes, and snippets.

@isacjunior
Last active September 25, 2020 02:13
Show Gist options
  • Save isacjunior/fa9adf3f59836f2a302927a390b212a0 to your computer and use it in GitHub Desktop.
Save isacjunior/fa9adf3f59836f2a302927a390b212a0 to your computer and use it in GitHub Desktop.
import 'package:flutter/cupertino.dart';
import 'package:doc_widget/doc_widget.dart';
/// ```dart
/// final button = Button(
/// 'Button',
/// onPressed: () => print('Doc Widget'),
/// );
/// ```
@docWidget
class Button extends StatelessWidget {
Button(
this.text, {
@required this.onPressed,
this.color = const Color(0xff007aff),
});
final String text;
final void Function() onPressed;
final Color color;
@override
Widget build(BuildContext context) {
return CupertinoButton(
color: color,
onPressed: onPressed,
child: Text(text),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment