迁移提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/home/domain/entities/home_entity.dart';
|
||||
|
||||
class PowerTrendChart extends StatelessWidget {
|
||||
@@ -25,25 +26,27 @@ class PowerTrendChart extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate('home_v2.power_trend'),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF5F7FA),
|
||||
color: context.appColors.fillBackground,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTypeButton(
|
||||
context,
|
||||
'day',
|
||||
AppLocalizations.of(context).translate('home_v2.day'),
|
||||
),
|
||||
_buildTypeButton(
|
||||
context,
|
||||
'month',
|
||||
AppLocalizations.of(context).translate('home_v2.month'),
|
||||
),
|
||||
@@ -57,13 +60,13 @@ class PowerTrendChart extends StatelessWidget {
|
||||
height: 220,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -76,13 +79,13 @@ class PowerTrendChart extends StatelessWidget {
|
||||
verticalInterval: 6,
|
||||
getDrawingHorizontalLine: (value) {
|
||||
return FlLine(
|
||||
color: const Color(0xFFE5E6EB).withOpacity(0.3),
|
||||
color: context.appColors.divider.withOpacity(0.3),
|
||||
strokeWidth: 1,
|
||||
);
|
||||
},
|
||||
getDrawingVerticalLine: (value) {
|
||||
return FlLine(
|
||||
color: const Color(0xFFE5E6EB).withOpacity(0.3),
|
||||
color: context.appColors.divider.withOpacity(0.3),
|
||||
strokeWidth: 1,
|
||||
);
|
||||
},
|
||||
@@ -108,8 +111,8 @@ class PowerTrendChart extends StatelessWidget {
|
||||
}
|
||||
return Text(
|
||||
time,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF86909C),
|
||||
style: TextStyle(
|
||||
color: context.appColors.textTertiary,
|
||||
fontSize: 12,
|
||||
),
|
||||
);
|
||||
@@ -126,8 +129,8 @@ class PowerTrendChart extends StatelessWidget {
|
||||
getTitlesWidget: (value, meta) {
|
||||
return Text(
|
||||
value.toInt().toString(),
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF86909C),
|
||||
style: TextStyle(
|
||||
color: context.appColors.textTertiary,
|
||||
fontSize: 12,
|
||||
),
|
||||
);
|
||||
@@ -154,14 +157,14 @@ class PowerTrendChart extends StatelessWidget {
|
||||
.map((e) => FlSpot(e.key.toDouble(), e.value.power))
|
||||
.toList(),
|
||||
isCurved: true,
|
||||
color: const Color(0xFF165DFF),
|
||||
color: context.appColors.primary,
|
||||
barWidth: 2,
|
||||
dotData: FlDotData(
|
||||
show: true,
|
||||
getDotPainter: (spot, percent, barData, index) {
|
||||
return FlDotCirclePainter(
|
||||
radius: 2,
|
||||
color: const Color(0xFF165DFF),
|
||||
color: context.appColors.primary,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -169,8 +172,8 @@ class PowerTrendChart extends StatelessWidget {
|
||||
show: true,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFF165DFF).withOpacity(0.2),
|
||||
const Color(0xFF165DFF).withOpacity(0.0),
|
||||
context.appColors.primary.withOpacity(0.2),
|
||||
context.appColors.primary.withOpacity(0.0),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
@@ -185,7 +188,7 @@ class PowerTrendChart extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTypeButton(String type, String label) {
|
||||
Widget _buildTypeButton(BuildContext context, String type, String label) {
|
||||
final isSelected = trendType == type;
|
||||
return GestureDetector(
|
||||
onTap: () => onToggleType(type),
|
||||
@@ -193,14 +196,16 @@ class PowerTrendChart extends StatelessWidget {
|
||||
width: 50,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? const Color(0xFF165DFF) : Colors.transparent,
|
||||
color: isSelected ? context.appColors.primary : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.white : const Color(0xFF86909C),
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: context.appColors.textTertiary,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user