createPresentationCubit method
void
createPresentationCubit()
Implementation
void createPresentationCubit(
String pathPage,
String pageName,
String className,
String methodName,
) {
final path = join(pathPage, 'presentation', 'cubit');
DirectoryHelper.createDir(path);
join(path, '${pageName}_state.dart')
.write('''part of '${pageName}_cubit.dart';
class ${className}StateCubit extends Equatable {
@override
List<Object?> get props => [];
}''');
join(path, '${pageName}_cubit.dart')
.write('''import 'package:core/core.dart';
import 'package:flutter/material.dart';
import '../pages/${pageName}_page.dart';
part '${pageName}_state.dart';
class ${className}Cubit extends MorphemeCubit<${className}StateCubit> {
${className}Cubit() : super(${className}StateCubit());
@override
void initState(BuildContext context) {
super.initState(context);
}
@override
void initAfterFirstLayout(BuildContext context) {
super.initAfterFirstLayout(context);
}
@override
void initArgument<Page>(BuildContext context, Page widget) {
super.initArgument(context, widget);
if(widget is! ${className}Page) return;
}
@override
void didChangeDependencies(BuildContext context) {
super.didChangeDependencies(context);
}
@override
void didUpdateWidget<Page>(
BuildContext context, Page oldWidget, Page widget) {
if (oldWidget is! ${className}Page || widget is! ${className}Page) return;
}
@override
List<BlocProvider> blocProviders(BuildContext context) => [];
@override
List<BlocListener> blocListeners(BuildContext context) => [];
@override
void dispose() {
super.dispose();
}
}''');
StatusHelper.generated(join(path, '${pageName}_cubit.dart'));
}