|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:project_telephony/ui/home/content_page.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'call.dart';
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
a();
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
Future<void> a()async {
|
|
|
|
await Future.delayed(const Duration(seconds: 0),(){
|
|
|
|
initializeService();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
extendBodyBehindAppBar: true,
|
|
|
|
extendBody: true,
|
|
|
|
body: SafeArea(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Image.asset(
|
|
|
|
Assets.images.homeBg.path,
|
|
|
|
height: 722.w,
|
|
|
|
width: 722.w,
|
|
|
|
)),
|
|
|
|
_getBody(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
_getBody() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"短信帮手",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 64.sp,
|
|
|
|
color: const Color(0xFF333333),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
32.hb,
|
|
|
|
Text(
|
|
|
|
"希望能成为您的短信小助手",
|
|
|
|
style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)),
|
|
|
|
),
|
|
|
|
50.hb,
|
|
|
|
_getContainer("接听后", "编辑接听后发送的短信内容", Assets.images.answer.path,
|
|
|
|
const Color(0xFF74BCFF), const Color(0xFF1890FF)),
|
|
|
|
30.hb,
|
|
|
|
_getContainer("拒接/未接后", "编辑拒接/未接后发送的短信内容", Assets.images.refused.path,
|
|
|
|
const Color(0xFF72E4C8), const Color(0xFF13CA9D))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_getContainer(String title, String text, String image, Color cl1, Color cl2) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
print(title);
|
|
|
|
if (title == "接听后") {
|
|
|
|
Get.to(() => const ContentPage(
|
|
|
|
isAnswer: true,
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
Get.to(() => const ContentPage(
|
|
|
|
isAnswer: false,
|
|
|
|
));
|
|
|
|
print("未接听");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Align(
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
colors: [cl1, cl2])),
|
|
|
|
width: 622.w,
|
|
|
|
height: 192.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: 48.w,
|
|
|
|
top: 35.w,
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 36.sp,
|
|
|
|
color: const Color(0xFFFFFFFF),
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
24.hb,
|
|
|
|
Text(
|
|
|
|
text,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 27.sp,
|
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Padding(
|
|
|
|
// padding: EdgeInsets.only(top: 40.w),
|
|
|
|
// child:
|
|
|
|
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
child: Image.asset(
|
|
|
|
image,
|
|
|
|
width: 166.w,
|
|
|
|
height: 152.w,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
// Container(
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(16.w),
|
|
|
|
// gradient: LinearGradient(
|
|
|
|
// end: Alignment.centerLeft,
|
|
|
|
// begin: Alignment.centerRight,
|
|
|
|
// colors: [cl1, cl2])),
|
|
|
|
// child:
|
|
|
|
// ),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|