1
This commit is contained in:
137
lib/page/plan/detail/widgets/avatar_card.dart
Normal file
137
lib/page/plan/detail/widgets/avatar_card.dart
Normal file
@@ -0,0 +1,137 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class AvatarCard extends StatefulWidget {
|
||||
const AvatarCard({super.key});
|
||||
|
||||
@override
|
||||
State<AvatarCard> createState() => _AvatarCardState();
|
||||
}
|
||||
|
||||
class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateMixin {
|
||||
bool _isShow = false;
|
||||
|
||||
late AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 400),
|
||||
);
|
||||
}
|
||||
|
||||
void _toggleShow() {
|
||||
setState(() {
|
||||
_isShow = !_isShow;
|
||||
if (_isShow) {
|
||||
_controller.forward();
|
||||
} else {
|
||||
_controller.reverse();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Transform(
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.identity()..translate(40.0, 40.0)..scale(0.2),
|
||||
child: Container(
|
||||
color: Colors.red,
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: InkWell(
|
||||
onTap: _toggleShow,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
border: Border.all(color: Colors.black, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
"好的,让我们把学习软件开发这个目标分解成最简单的小步骤,这样你明天就能轻松开始行动",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: CustomPaint(
|
||||
painter: BubblePainter(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Image.asset("assets/image/xiaozhi.png", height: 100),
|
||||
Positioned(
|
||||
top: 20,
|
||||
child: Transform.translate(
|
||||
offset: Offset(50, -10),
|
||||
child: GestureDetector(
|
||||
onTap: _toggleShow,
|
||||
child: Icon(RemixIcons.message_2_line, size: 26),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BubblePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
var bottomWidth = 10;
|
||||
//点坐标
|
||||
var start = Offset((size.width - bottomWidth) / 2, 0);
|
||||
//底线
|
||||
final bottomLinePaint = Paint()
|
||||
..color = Colors.white
|
||||
..strokeWidth = 2
|
||||
..style = PaintingStyle.stroke;
|
||||
final bottomLinePath = Path()
|
||||
..moveTo(start.dx, 0)
|
||||
..lineTo(start.dx + bottomWidth, 0);
|
||||
canvas.drawPath(bottomLinePath, bottomLinePaint);
|
||||
|
||||
//边线
|
||||
final sideLinePaint = Paint()
|
||||
..color = Colors.black
|
||||
..strokeWidth = 1
|
||||
..style = bottomLinePaint.style;
|
||||
|
||||
final sideLinePath = Path()
|
||||
..moveTo(start.dx, 0)
|
||||
..lineTo(start.dx + bottomWidth / 2, 5)
|
||||
..lineTo(start.dx + bottomWidth, 0);
|
||||
canvas.drawPath(sideLinePath, sideLinePaint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
71
lib/page/plan/detail/widgets/plan_item.dart
Normal file
71
lib/page/plan/detail/widgets/plan_item.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plan/widgets/business/delete_row_item.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class PlanItem extends StatefulWidget {
|
||||
final String title;
|
||||
final String desc;
|
||||
final bool showEdit;
|
||||
final Function(int) onDelete;
|
||||
|
||||
const PlanItem({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.desc,
|
||||
this.showEdit = false,
|
||||
required this.onDelete,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PlanItem> createState() => _PlanItemState();
|
||||
}
|
||||
|
||||
class _PlanItemState extends State<PlanItem> with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: DeleteRowItem(
|
||||
showDelete: widget.showEdit,
|
||||
onDelete: () {},
|
||||
builder: (_, animate) {
|
||||
return [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 3),
|
||||
child: Text(
|
||||
"完成以上步骤后,给自己倒杯水休息一下。",
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"就从这里开始,写下基本信息只需要2分钟,这是最简单的一部",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizeTransition(
|
||||
axis: Axis.horizontal,
|
||||
sizeFactor: animate,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Opacity(
|
||||
opacity: 0.4,
|
||||
child: Icon(RemixIcons.menu_line),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
23
lib/page/plan/detail/widgets/scroll_box.dart
Normal file
23
lib/page/plan/detail/widgets/scroll_box.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollBox extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const ScrollBox({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ScrollbarTheme(
|
||||
data: ScrollbarThemeData(
|
||||
thumbColor: WidgetStateProperty.all(Theme.of(context).colorScheme.surfaceContainerHigh),
|
||||
thickness: WidgetStateProperty.all(3),
|
||||
crossAxisMargin: 3,
|
||||
mainAxisMargin: 2,
|
||||
radius: const Radius.circular(5),
|
||||
),
|
||||
child: Scrollbar(
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
73
lib/page/plan/detail/widgets/suggested.dart
Normal file
73
lib/page/plan/detail/widgets/suggested.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
///模块标题
|
||||
class SuggestedTitle extends StatelessWidget {
|
||||
const SuggestedTitle({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
child: Opacity(
|
||||
opacity: 0.6,
|
||||
child: Row(
|
||||
spacing: 20,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 15,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
Text(
|
||||
"额外建议",
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
Container(
|
||||
width: 15,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SuggestedItem extends StatelessWidget {
|
||||
final String title;
|
||||
|
||||
const SuggestedItem({super.key, required this.title});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(0, 5),
|
||||
child: Icon(
|
||||
RemixIcons.lightbulb_flash_fill,
|
||||
color: Color(0xfff2a529),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Opacity(
|
||||
opacity: 0.5,
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user