createPresentationPage method

void createPresentationPage(
  1. String pathPage,
  2. String pageName,
  3. String className,
  4. String methodName,
)

Implementation

void createPresentationPage(
  String pathPage,
  String pageName,
  String className,
  String methodName,
) {
  final path = join(pathPage, 'presentation', 'pages');
  DirectoryHelper.createDir(path);
  join(path, '${pageName}_page.dart')
      .write('''import 'package:core/core.dart';
import 'package:flutter/material.dart';

import '../cubit/${pageName}_cubit.dart';

class ${className}Page extends StatefulWidget {
const ${className}Page({Key? key}) : super(key: key);

@override
State<${className}Page> createState() => _${className}PageState();
}

class _${className}PageState extends State<${className}Page>
  with MorphemeStatePage<${className}Page, ${className}Cubit> {
@override
${className}Cubit setCubit() => locator<${className}Cubit>();

@override
Widget buildWidget(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: const Text('$className')),
    body: Container(),
  );
}
}''');

  StatusHelper.generated(join(path, '${pageName}_page.dart'));
}