Skip to content

Commit

Permalink
Make base intent equatable
Browse files Browse the repository at this point in the history
  • Loading branch information
shounak-mulay committed Apr 12, 2024
1 parent 9f11aca commit e45da76
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter_template/presentation/entity/intent/intent.dart';

sealed class {{name.pascalCase()}}ScreenIntent implements BaseIntent {
sealed class {{name.pascalCase()}}ScreenIntent extends BaseIntent {
const {{name.pascalCase()}}ScreenIntent();
}
8 changes: 7 additions & 1 deletion lib/presentation/base/theme/theme_intent.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_template/presentation/entity/intent/intent.dart';

sealed class ThemeIntent implements BaseIntent {
sealed class ThemeIntent extends BaseIntent {
const ThemeIntent();
}

class SetThemeModeThemeIntent extends ThemeIntent {
final ThemeMode mode;

const SetThemeModeThemeIntent({required this.mode});

@override
List<Object?> get props => [mode];
}

class SetIsDynamicThemeIntent extends ThemeIntent {
final bool isDynamic;

const SetIsDynamicThemeIntent({required this.isDynamic});

@override
List<Object?> get props => [isDynamic];
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:flutter_template/presentation/entity/intent/intent.dart';

sealed class HomeScreenIntent implements BaseIntent {
sealed class HomeScreenIntent extends BaseIntent {
const HomeScreenIntent();
}

class SearchHomeScreenIntent extends HomeScreenIntent {
const SearchHomeScreenIntent();

@override
List<Object?> get props => [];
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import 'package:flutter_template/presentation/entity/intent/intent.dart';
import 'package:flutter_template/presentation/entity/weather/ui_city.dart';

sealed class SearchScreenIntent implements BaseIntent {
sealed class SearchScreenIntent extends BaseIntent {
const SearchScreenIntent();
}

class BackSearchScreenIntent extends SearchScreenIntent {
const BackSearchScreenIntent();

@override
List<Object?> get props => [];
}

class SearchSearchScreenIntent extends SearchScreenIntent {
final String searchTerm;

const SearchSearchScreenIntent({required this.searchTerm});

@override
List<Object?> get props => [searchTerm];
}

class ToggleFavoriteSearchScreenIntent extends SearchScreenIntent {
final UICity city;

const ToggleFavoriteSearchScreenIntent({required this.city});

@override
List<Object?> get props => [city];
}
6 changes: 5 additions & 1 deletion lib/presentation/entity/intent/intent.dart
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
interface class BaseIntent {}
import 'package:equatable/equatable.dart';

abstract class BaseIntent extends Equatable {
const BaseIntent();
}

0 comments on commit e45da76

Please sign in to comment.