init
This commit is contained in:
commit
78bad1fa3d
137 files changed
+5159
No files matched your search
@@ -0,0 +1,5 @@
|
||||
class Font {
|
||||
static const double FONT_SIZE_TITLE = 22;
|
||||
static const double FONT_SIZE_SUBTITLE = 16;
|
||||
static const double FONT_SIZE_CONTENT = 12;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:client/modules/home/home.dart';
|
||||
import 'package:client/modules/to_qrcode/to_qrcode.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(_App());
|
||||
}
|
||||
|
||||
class _App extends StatelessWidget {
|
||||
const _App({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
routes: {"to_qrcode": ((context) => ToQrcode())},
|
||||
home: Home(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class DualCheck extends StatefulWidget {
|
||||
const DualCheck({super.key});
|
||||
|
||||
@override
|
||||
State<DualCheck> createState() => _DualCheckState();
|
||||
}
|
||||
|
||||
class _DualCheckState extends State<DualCheck> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:client/const/font.dart';
|
||||
import 'package:client/modules/home/tool_card.dart';
|
||||
import 'package:client/modules/to_qrcode/to_qrcode.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
const Home({super.key});
|
||||
|
||||
@override
|
||||
State<Home> createState() => _HomeState();
|
||||
}
|
||||
|
||||
class _HomeState extends State<Home> {
|
||||
final toolsList = [ToQrcode()];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
scrolledUnderElevation: 0,
|
||||
title: Text(
|
||||
"工具站",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: Font.FONT_SIZE_TITLE,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
CircleAvatar(child: Text("登陆", style: TextStyle(fontSize: 12))),
|
||||
SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
body: GridView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 300,
|
||||
childAspectRatio: 1.7,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
),
|
||||
itemCount: toolsList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
enterCard(index);
|
||||
},
|
||||
child: ToolCard(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void enterCard(int index) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: ((context) => toolsList[index])),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../const/font.dart';
|
||||
|
||||
class ToolCard extends StatefulWidget {
|
||||
const ToolCard({super.key});
|
||||
|
||||
@override
|
||||
State<ToolCard> createState() => _ToolCardState();
|
||||
}
|
||||
|
||||
class _ToolCardState extends State<ToolCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Image.asset(
|
||||
"assets/qr_code_logo.png",
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ClipRect(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"二维码生成器",
|
||||
style: TextStyle(
|
||||
fontSize: Font.FONT_SIZE_SUBTITLE,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Divider(),
|
||||
SizedBox(height: 8),
|
||||
Container(
|
||||
child: Text(
|
||||
"上传文字,图片即可立即生成二维码",
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: Font.FONT_SIZE_CONTENT,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ToQrcode extends StatefulWidget {
|
||||
const ToQrcode({super.key});
|
||||
|
||||
@override
|
||||
State<ToQrcode> createState() => _ToQrcodeState();
|
||||
}
|
||||
|
||||
class _ToQrcodeState extends State<ToQrcode> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("二维码生成器"), centerTitle: true),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 200,
|
||||
height: 80,
|
||||
child: TextField(decoration: InputDecoration(hintText: "输入文本可上传")),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Container(
|
||||
width: 120,
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [Icon(Icons.image), Text("点击上传图片")],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user