fix: 初次提交

This commit is contained in:
2024-04-09 18:07:54 +08:00
commit c73693d40e
142 changed files with 5409 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import 'package:cherry_toast/cherry_toast.dart';
import 'package:cherry_toast/resources/arrays.dart';
import 'package:flutter/material.dart';
class ButtonWidgetsLess extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("按钮控件"),),
body: ButtonWidgets(),
);
}
}
class ButtonWidgets extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return ButtonWidgetsState();
}
}
class ButtonWidgetsState extends State<ButtonWidgets> {
@override
Widget build(BuildContext context) {
return Column(
children: [
// ElevatedButton样式
ElevatedButton(
onPressed: () =>
CherryToast(icon: Icons.info, themeColor: Colors.blue, title: Text("ElevatedButton"),).show(context),
child: Text("ElevatedButton")
),
TextButton(
onPressed: () => CherryToast.info(title: Text("TextButton"), toastPosition: Position.bottom,).show(context),
child: Text("TextButton")),
OutlinedButton(
onPressed: () => CherryToast.info(title: Text("你点击了OutlineButton")).show(context),
child: Text("OutlineButton")),
IconButton(
onPressed: () => CherryToast.info(title: Text("您点击了IconButton")).show(context),
icon: Icon(Icons.account_circle)
),
ElevatedButton.icon(
onPressed: () => CherryToast.info(title: Text("您点击了带图标的ElevatedButton"),).show(context),
icon: Icon(Icons.accessibility_new_sharp),
label: Text("带图标的ElevatedButton"))
],
);
}
}

View File

@@ -0,0 +1,33 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ImageAndIconWidgetsLess extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Image和Icon示例")),
body: ImageAndIconStateFullWidgets(),
);
}
}
class ImageAndIconStateFullWidgets extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return ImageAndIconState();
}
}
class ImageAndIconState extends State<ImageAndIconStateFullWidgets> {
@override
Widget build(BuildContext context) {
return Column(
children: [
// 本地Image
Image(image: AssetImage("images/cr7_messi.png"), width: 120,),
Image.asset("images/cr7_messi.png", width: 100, height: 150, fit: BoxFit.contain,)
],
);
}
}

View File

@@ -0,0 +1,54 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class TextWidgets extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("基础文本控件"),
backgroundColor: Colors.blue,
),
body: TextWidgetsBody(),
);
}
}
class TextWidgetsBody extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return TextWidgetsBodyState();
}
}
class TextWidgetsBodyState extends State<TextWidgetsBody> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Text("基础文本,居中显示"*4, textAlign: TextAlign.center,),
Text("尾部省略的文本"*4, maxLines: 1, overflow: TextOverflow.visible,),
Text("放大的文本", textScaler: TextScaler.linear(1.5),),
Text("文本样式测试", style: TextStyle(
color: Colors.amber,
fontFamily: "Courier",
decoration: TextDecoration.lineThrough
),),
Text.rich(TextSpan(
children: [
TextSpan(text: "富文本测试:"),
TextSpan(text: "http://www.baidu.com",
style: TextStyle(
decoration: TextDecoration.underline,
decorationColor: Colors.blue,
color: Colors.blue
),
)
]
))
],
);
}
}