cry 0.0.2 cry: ^0.0.2 copied to clipboard
一个Flutter组件库
import 'package:cry/cry_image_upload.dart';
import 'package:cry/cry_button.dart';
import 'package:cry/form/cry_input.dart';
import 'package:cry/form1/cry_input.dart' as form1;
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Cry Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Cry Demo Home Page'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DemoButton(),
DemoForm(),
DemoImageUpload(),
],
),
),
);
}
}
class DemoButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
var button = CryButton(
iconData: Icons.save,
label: 'testButton',
onPressed: () {
print('testButton');
},
);
return button;
}
}
class DemoForm extends StatelessWidget {
@override
Widget build(BuildContext context) {
var input = CryInput(label: 'testInput');
var input1 = form1.CryInput(label: 'testInput1');
return Column(
children: [input, input1],
);
}
}
class DemoImageUpload extends StatelessWidget {
@override
Widget build(BuildContext context) {
var imageUpload = CryImageUpload(
updateAreaSize: 200,
updateAreaDefault: Icon(Icons.person, size: 200),
onUpload: (imageBytes) {
print('onUpload');
},
);
return imageUpload;
}
}