content: import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  
  void main() => runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return CupertinoApp(
        home: MyHomePage(),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    @override
    State<StatefulWidget> createState() {
      return _MyHomePageState();
    }
  }
  
  class _MyHomePageState extends State<MyHomePage> {
    Duration initialTimer = const Duration(hours: 22, minutes: 30);
  
    @override
    Widget build(BuildContext context) {
      return CupertinoPageScaffold(
        navigationBar: const CupertinoNavigationBar(
          middle: Text('CupertinoTimerPicker'),
        ),
        child: Center(
          child: CupertinoButton(
            onPressed: () {
              showCupertinoModalPopup<void>(
                context: context,
                builder: (BuildContext context) {
                  return _buildBottomPicker(
                    CupertinoTimerPicker(
                      mode: CupertinoTimerPickerMode.hms,
                      minuteInterval: 1,
                      secondInterval: 1,
                      initialTimerDuration: initialTimer,
                      onTimerDurationChanged: (Duration changedTimer) {
                        setState(() {
                          initialTimer = changedTimer;
                        });
                      },
                    ),
                  );
                },
              );
            },
            child: const Text('開く'),
          ),
        ),
      );
    }
  
    Widget _buildBottomPicker(Widget picker) {
      return Container(
        height: 216,
        padding: const EdgeInsets.only(top: 6.0),
        color: CupertinoColors.white,
        child: DefaultTextStyle(
          style: const TextStyle(
            color: CupertinoColors.black,
            fontSize: 22.0,
          ),
          child: GestureDetector(
            onTap: () {},
            child: SafeArea(
              top: false,
              child: picker,
            ),
          ),
        ),
      );
    }
  }
  