Initial commit: SIBU 2.0 MISSION
This commit is contained in:
@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
import '../../../core/app_export.dart';
|
||||
|
||||
class EmptyStateWidget extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String? actionText;
|
||||
final VoidCallback? onActionPressed;
|
||||
|
||||
const EmptyStateWidget({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
this.actionText,
|
||||
this.onActionPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(8.w),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.lightTheme.colorScheme.secondary
|
||||
.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(15.w),
|
||||
),
|
||||
child: Center(
|
||||
child: CustomIconWidget(
|
||||
iconName: 'schedule',
|
||||
color: AppTheme.lightTheme.colorScheme.secondary,
|
||||
size: 15.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
Text(
|
||||
title,
|
||||
style: AppTheme.lightTheme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme.lightTheme.colorScheme.onSurface,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 2.h),
|
||||
Text(
|
||||
subtitle,
|
||||
style: AppTheme.lightTheme.textTheme.bodyMedium?.copyWith(
|
||||
color: AppTheme.lightTheme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (actionText != null && onActionPressed != null) ...[
|
||||
SizedBox(height: 4.h),
|
||||
ElevatedButton(
|
||||
onPressed: onActionPressed,
|
||||
child: Text(actionText!),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
import '../../../core/app_export.dart';
|
||||
import '../../../theme/app_theme.dart';
|
||||
|
||||
class NotificationBadgeWidget extends StatelessWidget {
|
||||
final int count;
|
||||
final Widget child;
|
||||
|
||||
const NotificationBadgeWidget({
|
||||
super.key,
|
||||
required this.count,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
child,
|
||||
if (count > 0)
|
||||
Positioned(
|
||||
right: -1.w,
|
||||
top: -0.5.h,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: count > 9 ? 1.5.w : 1.w,
|
||||
vertical: 0.5.h,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.lightTheme.colorScheme.error,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: AppTheme.lightTheme.colorScheme.surface,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 5.w,
|
||||
minHeight: 2.5.h,
|
||||
),
|
||||
child: Text(
|
||||
count > 99 ? '99+' : count.toString(),
|
||||
style: AppTheme.lightTheme.textTheme.labelSmall?.copyWith(
|
||||
color: AppTheme.lightTheme.colorScheme.onError,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 10.sp,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
import '../../../core/app_export.dart';
|
||||
|
||||
class RouteSelectionCard extends StatelessWidget {
|
||||
final String routeName;
|
||||
final String duration;
|
||||
final VoidCallback onTap;
|
||||
final bool isSelected;
|
||||
|
||||
const RouteSelectionCard({
|
||||
super.key,
|
||||
required this.routeName,
|
||||
required this.duration,
|
||||
required this.onTap,
|
||||
this.isSelected = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 4.w, vertical: 1.h),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
onTap();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.h),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppTheme.lightTheme.colorScheme.secondary
|
||||
.withValues(alpha: 0.1)
|
||||
: AppTheme.lightTheme.colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? AppTheme.lightTheme.colorScheme.secondary
|
||||
: AppTheme.lightTheme.colorScheme.outline,
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppTheme.lightTheme.shadowColor.withValues(alpha: 0.1),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
routeName,
|
||||
style:
|
||||
AppTheme.lightTheme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? AppTheme.lightTheme.colorScheme.primary
|
||||
: AppTheme.lightTheme.colorScheme.onSurface,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
SizedBox(height: 0.5.h),
|
||||
Text(
|
||||
'Duración estimada: $duration',
|
||||
style:
|
||||
AppTheme.lightTheme.textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
AppTheme.lightTheme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
CustomIconWidget(
|
||||
iconName: 'chevron_right',
|
||||
color: isSelected
|
||||
? AppTheme.lightTheme.colorScheme.secondary
|
||||
: AppTheme.lightTheme.colorScheme.onSurfaceVariant,
|
||||
size: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
236
old/lib/presentation/schedules_screen/widgets/schedule_card.dart
Normal file
236
old/lib/presentation/schedules_screen/widgets/schedule_card.dart
Normal file
@ -0,0 +1,236 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
import '../../../core/app_export.dart';
|
||||
|
||||
class ScheduleCard extends StatefulWidget {
|
||||
final String departureTime;
|
||||
final String duration;
|
||||
final String arrivalTime;
|
||||
final bool isNotificationEnabled;
|
||||
final VoidCallback onNotificationToggle;
|
||||
final VoidCallback? onLongPress;
|
||||
|
||||
const ScheduleCard({
|
||||
super.key,
|
||||
required this.departureTime,
|
||||
required this.duration,
|
||||
required this.arrivalTime,
|
||||
required this.isNotificationEnabled,
|
||||
required this.onNotificationToggle,
|
||||
this.onLongPress,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ScheduleCard> createState() => _ScheduleCardState();
|
||||
}
|
||||
|
||||
class _ScheduleCardState extends State<ScheduleCard>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _animationController;
|
||||
late Animation<double> _scaleAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_animationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 150),
|
||||
vsync: this,
|
||||
);
|
||||
_scaleAnimation = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.95,
|
||||
).animate(CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _handleTapDown(TapDownDetails details) {
|
||||
_animationController.forward();
|
||||
}
|
||||
|
||||
void _handleTapUp(TapUpDetails details) {
|
||||
_animationController.reverse();
|
||||
}
|
||||
|
||||
void _handleTapCancel() {
|
||||
_animationController.reverse();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 4.w, vertical: 1.h),
|
||||
child: AnimatedBuilder(
|
||||
animation: _scaleAnimation,
|
||||
builder: (context, child) {
|
||||
return Transform.scale(
|
||||
scale: _scaleAnimation.value,
|
||||
child: GestureDetector(
|
||||
onTapDown: _handleTapDown,
|
||||
onTapUp: _handleTapUp,
|
||||
onTapCancel: _handleTapCancel,
|
||||
onLongPress: widget.onLongPress != null
|
||||
? () {
|
||||
HapticFeedback.mediumImpact();
|
||||
widget.onLongPress!();
|
||||
}
|
||||
: null,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.lightTheme.colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: AppTheme.lightTheme.colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppTheme.lightTheme.shadowColor
|
||||
.withValues(alpha: 0.08),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Salida',
|
||||
style: AppTheme
|
||||
.lightTheme.textTheme.labelSmall
|
||||
?.copyWith(
|
||||
color: AppTheme.lightTheme.colorScheme
|
||||
.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 0.5.h),
|
||||
Text(
|
||||
widget.departureTime,
|
||||
style: AppTheme
|
||||
.lightTheme.textTheme.titleLarge
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme
|
||||
.lightTheme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 2.w, vertical: 0.5.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme
|
||||
.lightTheme.colorScheme.secondary
|
||||
.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
widget.duration,
|
||||
style: AppTheme
|
||||
.lightTheme.textTheme.labelMedium
|
||||
?.copyWith(
|
||||
color:
|
||||
AppTheme.lightTheme.colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 3.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'Llegada',
|
||||
style: AppTheme
|
||||
.lightTheme.textTheme.labelSmall
|
||||
?.copyWith(
|
||||
color: AppTheme.lightTheme.colorScheme
|
||||
.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 0.5.h),
|
||||
Text(
|
||||
widget.arrivalTime,
|
||||
style: AppTheme
|
||||
.lightTheme.textTheme.titleLarge
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme
|
||||
.lightTheme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 3.w),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
widget.onNotificationToggle();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(2.w),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.isNotificationEnabled
|
||||
? AppTheme.lightTheme.colorScheme.secondary
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: widget.isNotificationEnabled
|
||||
? AppTheme.lightTheme.colorScheme.secondary
|
||||
: AppTheme.lightTheme.colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: CustomIconWidget(
|
||||
iconName: widget.isNotificationEnabled
|
||||
? 'notifications'
|
||||
: 'notifications_none',
|
||||
color: widget.isNotificationEnabled
|
||||
? AppTheme.lightTheme.colorScheme.onSecondary
|
||||
: AppTheme
|
||||
.lightTheme.colorScheme.onSurfaceVariant,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
import '../../../core/app_export.dart';
|
||||
|
||||
class SearchBarWidget extends StatefulWidget {
|
||||
final String hintText;
|
||||
final ValueChanged<String> onChanged;
|
||||
final VoidCallback? onClear;
|
||||
|
||||
const SearchBarWidget({
|
||||
super.key,
|
||||
required this.hintText,
|
||||
required this.onChanged,
|
||||
this.onClear,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SearchBarWidget> createState() => _SearchBarWidgetState();
|
||||
}
|
||||
|
||||
class _SearchBarWidgetState extends State<SearchBarWidget> {
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
bool _hasText = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller.addListener(_onTextChanged);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.removeListener(_onTextChanged);
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onTextChanged() {
|
||||
final hasText = _controller.text.isNotEmpty;
|
||||
if (hasText != _hasText) {
|
||||
setState(() {
|
||||
_hasText = hasText;
|
||||
});
|
||||
}
|
||||
widget.onChanged(_controller.text);
|
||||
}
|
||||
|
||||
void _clearSearch() {
|
||||
_controller.clear();
|
||||
widget.onClear?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 4.w, vertical: 1.h),
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
style: AppTheme.lightTheme.textTheme.bodyMedium,
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.hintText,
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.all(3.w),
|
||||
child: CustomIconWidget(
|
||||
iconName: 'search',
|
||||
color: AppTheme.lightTheme.colorScheme.onSurfaceVariant,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
suffixIcon: _hasText
|
||||
? IconButton(
|
||||
icon: CustomIconWidget(
|
||||
iconName: 'clear',
|
||||
color: AppTheme.lightTheme.colorScheme.onSurfaceVariant,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: _clearSearch,
|
||||
)
|
||||
: null,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: AppTheme.lightTheme.colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: AppTheme.lightTheme.colorScheme.outline,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: AppTheme.lightTheme.colorScheme.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: AppTheme.lightTheme.colorScheme.surface,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.h),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user