This commit is contained in:
tao
2025-09-01 09:23:42 +08:00
parent 0af8d30cae
commit 00a81e4e7b
5 changed files with 63 additions and 49 deletions

View File

@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:derma_flutter/router/config/route_paths.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:go_router/go_router.dart';
@@ -26,9 +27,13 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
///打开相机拍照
void _handTakePhoto() async {
var photo = await _picker.pickImage(source: ImageSource.camera);
if (photo != null) {
_startDetect(photo.path);
try {
var photo = await _picker.pickImage(source: ImageSource.camera);
if (photo != null) {
_startDetect(photo.path);
}
} on PlatformException catch (e) {
EasyLoading.showToast(e.message ?? "");
}
}
@@ -46,7 +51,7 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
///开始检测
void _startDetect(String path) async {
//压缩
final result = await FlutterImageCompress.compressWithFile(
final result = await FlutterImageCompress.compressWithFile(
path,
minWidth: 1080,
minHeight: 1920,

View File

@@ -23,16 +23,20 @@ class _ItemWidgetState extends State<ItemWidget> {
@override
Widget build(BuildContext context) {
var color = Colors.black;
var statusText = "";
switch (widget.data.skinStatus) {
case 1:
color = Theme.of(context).colorScheme.success;
statusText = "healthy";
break;
case 2:
color = Theme.of(context).colorScheme.warning;
statusText = "issues";
break;
case 3:
color = Theme.of(context).colorScheme.error;
statusText = "error";
break;
default:
color = Colors.black;
@@ -90,7 +94,7 @@ class _ItemWidgetState extends State<ItemWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"healthy",
statusText,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: color),
),
Container(

View File

@@ -32,33 +32,38 @@ class AgreementBox extends StatelessWidget {
),
),
),
RichText(
text: TextSpan(
style: Theme.of(context).textTheme.labelSmall,
children: [
TextSpan(
text: "I agree to the ",
),
TextSpan(
text: "Terms",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Terms of Service", "url": "https://support.curain.ai/privacy/derma/terms_service.html"},
),
),
TextSpan(text: " & "),
TextSpan(
text: "Privacy Policy",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Privacy", "url": "https://support.curain.ai/privacy/derma/privacy_policy.html"},
),
),
],
GestureDetector(
onTap: () {
onChanged(!checked);
},
child: RichText(
text: TextSpan(
style: Theme.of(context).textTheme.labelSmall,
children: [
TextSpan(
text: "I agree to the ",
),
TextSpan(
text: "Terms",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Terms of Service", "url": "https://support.curain.ai/privacy/derma/terms_service.html"},
),
),
TextSpan(text: " & "),
TextSpan(
text: "Privacy Policy",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Privacy", "url": "https://support.curain.ai/privacy/derma/privacy_policy.html"},
),
),
],
),
),
),
],