content: import 'package:flutter/material.dart';
  
  void main() => runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    @override
    _MyHomePageState createState() => _MyHomePageState();
  }
  
  class _MyHomePageState extends State<MyHomePage> {
    final GlobalKey<ScaffoldState> _key = GlobalKey<ScaffoldState>();
  
    void _showBar() {
      _key.currentState.showSnackBar(
        SnackBar(
          content: const Text('Hello World'),
          action: SnackBarAction(
            label: 'action',
            onPressed: () {
              print('called action');
            },
          ),
        ),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        key: _key,
        appBar: AppBar(
          title: const Text('showSnackBar'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(32.0),
          child: Center(
            child: Column(
              children: <Widget>[
                RaisedButton(
                  onPressed: _showBar,
                  child: const Text('開く'),
                )
              ],
            ),
          ),
        ),
      );
    }
  }
  