refactor(widgets): 重构卡片组件的样式

- 统一了卡片的阴影、边框和圆角样式
- 调整了卡片的外边距
- 优化了部分卡片的内边距
- 统一了难度等级的命名方式
This commit is contained in:
高手 2025-06-10 16:33:54 +08:00
parent 4d9a554f0d
commit 6b64d1a0cd
4 changed files with 44 additions and 18 deletions

View File

@ -125,6 +125,13 @@ class _GiteaCardState extends State<GiteaCard> {
@override
Widget build(BuildContext context) {
return Card(
elevation: 4,
shadowColor: Colors.deepPurple.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: Colors.deepPurple.withOpacity(0.1)),
),
margin: const EdgeInsets.symmetric(vertical: 8.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(

View File

@ -101,6 +101,13 @@ class _GithubCardState extends State<GithubCard> {
@override
Widget build(BuildContext context) {
return Card(
elevation: 4,
shadowColor: Colors.deepPurple.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: Colors.deepPurple.withOpacity(0.1)),
),
margin: const EdgeInsets.symmetric(vertical: 8.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(

View File

@ -119,9 +119,13 @@ class _KodBoxCardState extends State<KodBoxCard> {
final sourceID = isFileOperation ? _getSourceID(desc) : null;
return Card(
elevation: 2,
margin: const EdgeInsets.symmetric(vertical: 6.0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
elevation: 4,
shadowColor: Colors.deepPurple.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: Colors.deepPurple.withOpacity(0.1)),
),
margin: const EdgeInsets.symmetric(vertical: 5.0),
child: InkWell(
onTap: sourceID != null ? () => _launchFileUrl(sourceID) : null,
splashColor: Colors.deepPurple.withAlpha(30),
@ -211,9 +215,13 @@ class _KodBoxCardState extends State<KodBoxCard> {
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 4,
margin: const EdgeInsets.all(16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: BorderSide(color: Colors.deepPurple.withOpacity(0.15)),
),
elevation: 6,
shadowColor: Colors.deepPurple.withOpacity(0.4),
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(

View File

@ -143,11 +143,11 @@ class _LeetCodeCardState extends State<LeetCodeCard>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
const Row(
children: [
const Icon(Icons.bar_chart, color: Colors.green),
const SizedBox(width: 8),
const Text(
Icon(Icons.bar_chart, color: Colors.green),
SizedBox(width: 8),
Text(
'解题进度',
style: TextStyle(
fontSize: 18,
@ -161,11 +161,11 @@ class _LeetCodeCardState extends State<LeetCodeCard>
final difficulty = q['difficulty'] as String;
final count = q['count'] as int;
Color difficultyColor = Colors.grey;
if (difficulty == 'Easy')
if (difficulty == 'EASY')
difficultyColor = Colors.green;
else if (difficulty == 'Medium')
else if (difficulty == 'MEDIUM')
difficultyColor = Colors.orange;
else if (difficulty == 'Hard') difficultyColor = Colors.red;
else if (difficulty == 'HARD') difficultyColor = Colors.red;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 6.0),
@ -226,9 +226,13 @@ class _LeetCodeCardState extends State<LeetCodeCard>
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 4,
margin: const EdgeInsets.all(16),
shadowColor: Colors.deepPurple.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: Colors.deepPurple.withOpacity(0.1)),
),
margin: const EdgeInsets.symmetric(vertical: 8.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
@ -332,11 +336,11 @@ class _LeetCodeCardState extends State<LeetCodeCard>
final question = submission['question'];
return Card(
elevation: 2,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
),
margin: const EdgeInsets.symmetric(vertical: 6),
margin: const EdgeInsets.symmetric(vertical: 4),
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.green,