LabWork07 minor changes
This commit is contained in:
parent
10e0166740
commit
a4fcdc5715
@ -2,7 +2,6 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pmu_labworks/components/extensions/context_x.dart';
|
||||
import 'package:pmu_labworks/components/locale/l10n/app_locale.dart';
|
||||
import 'package:pmu_labworks/data/repositories/potterdb_repository.dart';
|
||||
import 'package:pmu_labworks/view/home_page/bloc/bloc.dart';
|
||||
@ -44,7 +43,7 @@ class MyApp extends StatelessWidget {
|
||||
child: BlocProvider<HomeBloc>(
|
||||
lazy: false,
|
||||
create: (context) => HomeBloc(context.read<PotterDBRepository>()),
|
||||
child: HomePage(title: "Comments App"),
|
||||
child: const HomePage(title: "Comments App"),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -1,8 +1,6 @@
|
||||
part of 'home_page.dart';
|
||||
|
||||
typedef OnLikeCallback = void Function(
|
||||
String? id, String nickname, bool isLiked, bool isDisliked)?;
|
||||
typedef OnDislikeCallback = void Function(
|
||||
typedef OnReactionCallback = void Function(
|
||||
String? id, String nickname, bool isLiked, bool isDisliked)?;
|
||||
|
||||
class _Comment extends StatelessWidget {
|
||||
@ -12,8 +10,8 @@ class _Comment extends StatelessWidget {
|
||||
final UserData user;
|
||||
final bool isLiked;
|
||||
final bool isDisliked;
|
||||
final OnLikeCallback? onLike;
|
||||
final OnDislikeCallback? onDislike;
|
||||
final OnReactionCallback? onLike;
|
||||
final OnReactionCallback? onDislike;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const _Comment({
|
||||
@ -32,8 +30,8 @@ class _Comment extends StatelessWidget {
|
||||
CommentData data, {
|
||||
bool isLiked = false,
|
||||
bool isDisliked = false,
|
||||
OnLikeCallback? onLike,
|
||||
OnDislikeCallback? onDislike,
|
||||
OnReactionCallback? onLike,
|
||||
OnReactionCallback? onDislike,
|
||||
VoidCallback? onTap,
|
||||
}) =>
|
||||
_Comment(
|
||||
@ -123,7 +121,9 @@ class _Comment extends StatelessWidget {
|
||||
IconButton(
|
||||
iconSize: 20,
|
||||
icon: Icon(
|
||||
isDisliked ? Icons.thumb_down : Icons.thumb_down_outlined,
|
||||
isDisliked
|
||||
? Icons.thumb_down
|
||||
: Icons.thumb_down_outlined,
|
||||
color: isDisliked ? Colors.red : Colors.grey,
|
||||
),
|
||||
onPressed: _onDislike,
|
||||
|
Loading…
Reference in New Issue
Block a user