feat: Add border color support to NoteCard and DraggableNote for enhanced visual distinction

This commit is contained in:
2026-05-21 17:34:50 +02:00
parent 2f942c4e82
commit a9d818dec4
2 changed files with 22 additions and 3 deletions
+10 -1
View File
@@ -313,6 +313,10 @@ class _HomeScreenState extends State<HomeScreen> {
final int crossAxisCount = math.max((width / 250).floor().round(), 2); final int crossAxisCount = math.max((width / 250).floor().round(), 2);
final List<Note> visibleNotes = _getFilteredNotes(); final List<Note> visibleNotes = _getFilteredNotes();
final Category? currentCategory = _currentCategory(); final Category? currentCategory = _currentCategory();
final Map<String, Color> categoryBorderColors = <String, Color>{
for (final Category category in _categories)
if (category.colorValue != null) category.id: Color(category.colorValue!),
};
final Widget body = _isLoading final Widget body = _isLoading
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
@@ -371,6 +375,7 @@ class _HomeScreenState extends State<HomeScreen> {
final Widget draggableNote = _DraggableNote( final Widget draggableNote = _DraggableNote(
note: filteredNotes[index], note: filteredNotes[index],
borderColor: categoryBorderColors[filteredNotes[index].categoryId],
dataIndex: _notes.indexOf( dataIndex: _notes.indexOf(
filteredNotes[index], filteredNotes[index],
), ),
@@ -564,6 +569,7 @@ class _HomeScreenState extends State<HomeScreen> {
class _DraggableNote extends StatelessWidget { class _DraggableNote extends StatelessWidget {
const _DraggableNote({ const _DraggableNote({
required this.note, required this.note,
this.borderColor,
required this.dataIndex, required this.dataIndex,
required this.cellWidth, required this.cellWidth,
required this.requiresLongPressToDrag, required this.requiresLongPressToDrag,
@@ -576,6 +582,7 @@ class _DraggableNote extends StatelessWidget {
}); });
final Note note; final Note note;
final Color? borderColor;
final int dataIndex; final int dataIndex;
final double cellWidth; final double cellWidth;
final bool requiresLongPressToDrag; final bool requiresLongPressToDrag;
@@ -611,6 +618,7 @@ class _DraggableNote extends StatelessWidget {
note: note, note: note,
onTap: () {}, onTap: () {},
isDragging: true, isDragging: true,
borderColor: borderColor,
), ),
), ),
), ),
@@ -629,7 +637,7 @@ class _DraggableNote extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(24, 25, 26, 1), color: const Color.fromRGBO(24, 25, 26, 1),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.white24, width: 1), border: Border.all(color: borderColor ?? Colors.white24, width: 1),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -673,6 +681,7 @@ class _DraggableNote extends StatelessWidget {
note: note, note: note,
onTap: onTap, onTap: onTap,
isDragging: isDragging, isDragging: isDragging,
borderColor: borderColor,
), ),
); );
+12 -2
View File
@@ -8,11 +8,18 @@ import 'package:notas/models/note.dart';
// like MasonryGridView or Draggable feedback). Visual styling only. // like MasonryGridView or Draggable feedback). Visual styling only.
class NoteCard extends StatefulWidget { class NoteCard extends StatefulWidget {
const NoteCard({super.key, required this.note, this.onTap, this.isDragging = false}); const NoteCard({
super.key,
required this.note,
this.onTap,
this.isDragging = false,
this.borderColor,
});
final Note note; final Note note;
final VoidCallback? onTap; final VoidCallback? onTap;
final bool isDragging; final bool isDragging;
final Color? borderColor;
@override @override
State<NoteCard> createState() => _NoteCardState(); State<NoteCard> createState() => _NoteCardState();
@@ -55,7 +62,10 @@ class _NoteCardState extends State<NoteCard> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(24, 25, 26, 1), color: const Color.fromRGBO(24, 25, 26, 1),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.white24, width: 1), border: Border.all(
color: widget.borderColor ?? Colors.white24,
width: 1,
),
), ),
child: LayoutBuilder( child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {