build method

  1. @override
Widget build(
  1. BuildContext context,
  2. PageRef ref
)
override

Build the internal widget.

The context used during the build is passed as is.

Also, WidgetRef is passed to ref to update the state.

内部のウィジェットをビルドします。

ビルド中に使用されるcontextがそのまま渡されます。

また、refに状態を更新するためのPageRefが渡されます。

Implementation

@override
Widget build(BuildContext context, PageRef ref) {
  // Describes the process of loading
  // and defining variables required for the page.
  final adapter =
      MasamuneAdapterScope.of<SimpleBlogModuleMasamuneAdapter>(context);

  // Describes the structure of the page.
  return ClipRRect(
    borderRadius: BorderRadius.circular(16),
    child: SizedBox(
      width: context.mediaQuery.size.width * 0.8,
      height: context.mediaQuery.size.height * 0.8,
      child: UniversalScaffold(
        backgroundColor: Colors.black87,
        appBar: UniversalAppBar(
          automaticallyImplyLeading: AutomaticallyImplyLeadingType.onlyDrawer,
          leading: IconButton(
            onPressed: () {
              adapter!.router.pop();
            },
            color: Colors.white,
            icon: const Icon(Icons.close),
          ),
        ),
        body: Center(
          child: InteractiveViewer(
            minScale: 0.1,
            maxScale: 5.0,
            child: Image(
              image: Asset.image(imageUrl),
              fit: BoxFit.fitWidth,
            ),
          ),
        ),
      ),
    ),
  );
}