登录流程已全部重构
This commit is contained in:
27
lib/widgets/shared/app_backend.dart
Normal file
27
lib/widgets/shared/app_backend.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppBackend extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const AppBackend({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Color(0xffdff8fb),
|
||||
Color(0xffffffff),
|
||||
Color(0xffdff8fb),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: SafeArea(child: child),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/widgets/shared/app_header.dart
Normal file
43
lib/widgets/shared/app_header.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppHeader extends StatefulWidget {
|
||||
const AppHeader({super.key});
|
||||
|
||||
@override
|
||||
State<AppHeader> createState() => _AppHeaderState();
|
||||
}
|
||||
|
||||
class _AppHeaderState extends State<AppHeader> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/image/logo.png",
|
||||
width: 44,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"FoodCura",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
"AI Health Guardian",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/widgets/shared/async_image.dart
Normal file
43
lib/widgets/shared/async_image.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AsyncImage extends StatelessWidget {
|
||||
final String url;
|
||||
final double? width;
|
||||
|
||||
const AsyncImage({
|
||||
super.key,
|
||||
required this.url,
|
||||
this.width,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: width,
|
||||
child: CachedNetworkImage(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: url ?? "",
|
||||
imageBuilder: (context, imageProvider) => Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: imageProvider,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
placeholder: (context, url) => Container(
|
||||
alignment: Alignment.center,
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.3,
|
||||
heightFactor: 0.3,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user