AtmoSphere/lib/screens/messages_screen.dart
2026-01-16 18:22:32 +08:00

89 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import '../constants.dart';
class MessagesScreen extends StatelessWidget {
const MessagesScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Messages')),
body: ListView(
padding: const EdgeInsets.all(16.0),
children: const [
_MessageCard(
icon: Icons.wb_sunny,
title: 'Welcome to AtmoSphere!',
body: 'Your dynamic wallpaper is now active. Enjoy the view.',
time: '2 min ago',
iconColor: Colors.yellow,
),
_MessageCard(
icon: Icons.cloud_off,
title: 'Weather Alert: London',
body: 'Heavy rain expected tomorrow from 8:00 AM. Stay dry!',
time: '1h ago',
iconColor: Colors.blue,
),
_MessageCard(
icon: Icons.palette,
title: 'New Wallpaper Pack',
body:
"Check out the new 'Urban Nights' pack in the wallpaper gallery.",
time: '1d ago',
iconColor: Colors.purpleAccent,
),
],
),
);
}
}
class _MessageCard extends StatelessWidget {
final IconData icon;
final Color iconColor;
final String title;
final String body;
final String time;
const _MessageCard({
required this.icon,
required this.iconColor,
required this.title,
required this.body,
required this.time,
});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 16.0),
decoration: BoxDecoration(
color: kCardBackground,
borderRadius: kCardBorderRadius,
),
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.black.withOpacity(0.3),
child: Icon(icon, color: iconColor),
),
title: Text(
title,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
subtitle: Text(
body,
style: TextStyle(color: Colors.white.withOpacity(0.8)),
),
trailing: Text(
time,
style: TextStyle(color: Colors.white.withOpacity(0.5), fontSize: 12),
),
),
);
}
}