Commit dc95c1fe authored by Daniel Tefr's avatar Daniel Tefr
Browse files

Merge branch 'design-changes' into 'master'

Design changes

See merge request xtefr/harmonis!6
parents 47e12c6c 1ee651fb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ class PageTemplate extends StatelessWidget {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).cardColor,
        title: Text(title),
        actions: [actions ?? const SizedBox()],
      ),
+2 −2
Original line number Diff line number Diff line
@@ -22,10 +22,10 @@ class DashBoardPage extends StatelessWidget {
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Theme.of(context).primaryColor,
              Theme.of(context).cardColor,
              Theme.of(context).primaryColor,
            ],
            begin: Alignment.topLeft,
            begin: Alignment.topCenter,
            end: Alignment.bottomRight,
          ),
        ),
+3 −9
Original line number Diff line number Diff line
@@ -44,14 +44,14 @@ class FilterBar extends StatelessWidget {
                      showLikedOnly ? Icons.favorite : Icons.favorite_border,
                      color: showLikedOnly
                          ? Colors.white
                          : Colors.white.withOpacity(0.6),
                          : Colors.white.withOpacity(0.8),
                    ),
                    label: Text(
                      "Liked",
                      style: TextStyle(
                        color: showLikedOnly
                            ? Colors.white
                            : Colors.white.withOpacity(0.6),
                            : Colors.white.withOpacity(0.8),
                      ),
                    ),
                  ),
@@ -65,12 +65,6 @@ class FilterBar extends StatelessWidget {
                        backgroundColor: isSelected
                            ? Theme.of(context).primaryColor
                            : Theme.of(context).primaryColor.withOpacity(0.1),
                        side: BorderSide(
                          color: isSelected
                              ? Theme.of(context).primaryColor
                              : Theme.of(context).primaryColor.withOpacity(0.1),
                          width: 2.0,
                        ),
                      ),
                      onPressed: () {
                        filterService.toggleGenre(genre);
@@ -80,7 +74,7 @@ class FilterBar extends StatelessWidget {
                        style: TextStyle(
                          color: isSelected
                              ? Colors.white
                              : Colors.white.withOpacity(0.6),
                              : Colors.white.withOpacity(0.8),
                        ),
                      ),
                    ),
+28 −11
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:harmonis/userInteraction/model/comment_DTO.dart';
import '../../common/text_input_field.dart';

class SongComment extends StatelessWidget {
class SongComment extends StatefulWidget {
  final CommentDTO comment;
  final bool expanded;
  final VoidCallback onExpand;
@@ -18,9 +18,26 @@ class SongComment extends StatelessWidget {
  });

  @override
  Widget build(BuildContext context) {
    final TextEditingController replyController = TextEditingController();
  State<SongComment> createState() => _SongCommentState();
}

class _SongCommentState extends State<SongComment> {
  late TextEditingController replyController;

  @override
  void initState() {
    super.initState();
    replyController = TextEditingController();
  }

  @override
  void dispose() {
    replyController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
      elevation: 2,
@@ -42,14 +59,14 @@ class SongComment extends StatelessWidget {
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        comment.author.name,
                        widget.comment.author.name,
                        style: Theme.of(context)
                            .textTheme
                            .bodyLarge
                            ?.copyWith(fontWeight: FontWeight.bold),
                      ),
                      Text(
                        '${comment.timeStamp.hour.toString().padLeft(2, '0')}:${comment.timeStamp.minute.toString().padLeft(2, '0')} on ${comment.timeStamp.day}/${comment.timeStamp.month}/${comment.timeStamp.year}',
                        '${widget.comment.timeStamp.hour.toString().padLeft(2, '0')}:${widget.comment.timeStamp.minute.toString().padLeft(2, '0')} on ${widget.comment.timeStamp.day}/${widget.comment.timeStamp.month}/${widget.comment.timeStamp.year}',
                        style: Theme.of(context)
                            .textTheme
                            .bodySmall
@@ -60,21 +77,21 @@ class SongComment extends StatelessWidget {
                ),
                IconButton(
                  icon: Icon(
                    expanded ? Icons.expand_less : Icons.expand_more,
                    widget.expanded ? Icons.expand_less : Icons.expand_more,
                    color: Theme.of(context).primaryColor,
                  ),
                  onPressed: onExpand,
                  onPressed: widget.onExpand,
                ),
              ],
            ),
            const SizedBox(height: 8),
            Text(
              comment.text,
              widget.comment.text,
              style: Theme.of(context).textTheme.bodyLarge,
            ),
            if (expanded) ...[
            if (widget.expanded) ...[
              const Divider(),
              for (CommentDTO reply in comment.replies)
              for (CommentDTO reply in widget.comment.replies)
                Padding(
                  padding: const EdgeInsets.only(bottom: 8.0),
                  child: Row(
@@ -98,7 +115,7 @@ class SongComment extends StatelessWidget {
                onSend: () {
                  final reply = replyController.text.trim();
                  if (reply.isNotEmpty) {
                    onReply(reply);
                    widget.onReply(reply);
                    replyController.clear();
                  }
                },
+27 −5
Original line number Diff line number Diff line
@@ -5,9 +5,12 @@ import 'package:harmonis/songPost/model/song_post_DTO.dart';
import 'package:harmonis/user/model/user_DTO.dart';
import 'package:harmonis/user/services/userService.dart';

import '../../songPost/service/song_post_service.dart';

class SongPost extends StatelessWidget {
  final SongPostDTO post;
  final userService = GetIt.instance<UserService>();
  final songPostService = GetIt.instance<SongPostService>();

  SongPost({
    super.key,
@@ -37,8 +40,8 @@ class SongPost extends StatelessWidget {
                borderRadius: BorderRadius.circular(12.0),
                child: const Image(
                  image: AssetImage('assets/images/empty_cover.png'),
                  width: 60,
                  height: 60,
                  width: 80,
                  height: 80,
                  fit: BoxFit.cover,
                ),
              ),
@@ -85,9 +88,28 @@ class SongPost extends StatelessWidget {
                },
              ),
              IconButton(
                icon: const Icon(Icons.delete, color: Colors.grey),
                onPressed: () {
                  userService.toggleSongPostLike(post.uId);
                icon: Icon(Icons.delete, color: Colors.grey),
                onPressed: () async {
                  final confirmed = await showDialog<bool>(
                    context: context,
                    builder: (context) => AlertDialog(
                      title: Text("Delete Song"),
                      content: Text("Are you sure you want to delete this song?"),
                      actions: [
                        TextButton(
                          onPressed: () => Navigator.of(context).pop(false),
                          child: Text("Cancel"),
                        ),
                        TextButton(
                          onPressed: () => Navigator.of(context).pop(true),
                          child: Text("Delete"),
                        ),
                      ],
                    ),
                  );
                  if (confirmed == true) {
                    songPostService.deleteSongPost(post.uId);
                  }
                },
              ),
            ],
Loading