body method

  1. @override
String body(
  1. String path,
  2. String baseName,
  3. String className
)
override

Defines the actual body code. path is passed relative to lib, baseName is the filename, and className is the filename converted to Pascal case.

実際の本体コードを定義します。pathlibからの相対パス、baseNameにファイル名が渡され、classNameにファイル名をパスカルケースに変換した値が渡されます。

Implementation

@override
String body(String path, String baseName, String className) {
  return r"""
return SafeArea(
child: Column(
  mainAxisSize: MainAxisSize.max,
  mainAxisAlignment: MainAxisAlignment.center,
  children: [
    const Spacer(flex: 1),
    Expanded(
      flex: 10,
      child: ClipRRect(
        borderRadius: 16.r,
        child: Image(
          image: theme.asset.image.provider,
          width: 128,
          height: 128,
        ),
      ),
    ),
    Expanded(
      flex: 6,
      child: SingleChildScrollView(
        reverse: true,
        padding: const EdgeInsets.fromLTRB(32, 0, 32, 48),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            OutlinedButton.icon(
              label: Text(l().signInWith.$(l().google)),
              icon: Icon(
                FontAwesomeIcons.google,
                color: authFormButtonStyle.foregroundColor?.resolve({}),
              ),
              style: authFormButtonStyle,
              onPressed: () async {
                executeGuarded(
                  context,
                  () async {
                    // TODO: Uncomment when Firebase is integrated
                    // await appAuth.signIn(
                    //   const FirebaseGoogleSignInAuthProvider(),
                    // );
                    router.replace(IndexPage.query());
                  },
                  onError: (error, stackTrace) {
                    debugPrint(error.toString());
                    Modal.alert(
                      context,
                      submitText: l().close,
                      title: l().error,
                      text: l().$(l().login).hasFailed,
                    );
                  },
                );
              },
            ),
            if (UniversalPlatform.isIOS) ...[
              16.sy,
              OutlinedButton.icon(
                label: Text(l().signInWith.$(l().apple)),
                icon: Icon(
                  FontAwesomeIcons.apple,
                  color: authFormButtonStyle.foregroundColor?.resolve({}),
                ),
                style: authFormButtonStyle,
                onPressed: () async {
                  executeGuarded(
                    context,
                    () async {
                      // TODO: Uncomment when Firebase is integrated
                      // await appAuth.signIn(
                      //   const FirebaseAppleSignInAuthProvider(),
                      // );
                      router.replace(IndexPage.query());
                    },
                    onError: (error, stackTrace) {
                      Modal.alert(
                        context,
                        submitText: l().close,
                        title: l().error,
                        text: l().$(l().login).hasFailed,
                      );
                    },
                  );
                },
              ),
            ],
            8.sy,
          ],
        ),
      ),
    ),
    const Spacer(flex: 1),
  ],
),
);
""";
}