I am trying to get my Flutter App approved in the Google Play Store. I have come accross and issue that I am trying to display a dialog that informs the user that location is being used in the blackground so that the app can be approved. I can't seem to figure the dialog out. I can get the dialog to pop up but the screen goes blank behind it and then the OK button doesn't work or dismiss the dialog. I am certain that I don't know enough about Flutter to figure out what the issue is or what I am missing and I can't seem to find any examples of code that might help me get my app in compliance. Thanks in advance for your assistance.

import 'package:flutter/material.dart';
import 'package:flutter_blue/flutter_blue.dart';
import 'package:growtulsaapp/pages/howmuchcanyoupower.dart';
import 'package:growtulsaapp/pages/collectdata.dart';

class PairPM extends StatefulWidget {
  final String activity;
  PairPM({this.activity});

  final FlutterBlue flutterBlue = FlutterBlue.instance;
  final List<BluetoothDevice> devicesList = new List<BluetoothDevice>();

  @override
  _PairPMState createState() => _PairPMState();

}

class _PairPMState extends State<PairPM> with WidgetsBindingObserver {

  void _showAlert(BuildContext context) {
    showDialog(
        context: context,
        builder: (context) => AlertDialog(
          content: Text("hi"),
        ));
  }

  _addDeviceTolist(final BluetoothDevice device) {
    if (!widget.devicesList.contains(device)) {
      if (device.name.contains("PM5")) {
        widget.devicesList.add(device);
      }
      setState(() {

      });
    }
  }

  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  void initState() {
    super.initState();

    print('init state fired');
    WidgetsBinding.instance.addObserver(this);
    widget.flutterBlue.connectedDevices
        .asStream()
        .listen((List<BluetoothDevice> devices) {
      for (BluetoothDevice device in devices) {
          _addDeviceTolist(device);
      }
    });
    widget.flutterBlue.scanResults.listen((List<ScanResult> results) {
      for (ScanResult result in results) {
        _addDeviceTolist(result.device);
      }
    });
    widget.flutterBlue.startScan();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if (state == AppLifecycleState.paused) {
      print('went to background');
      // went to Background
    }
    if (state == AppLifecycleState.resumed) {
      widget.devicesList.length = 0;
      print('set devices to nothing');
      // came back to Foreground
    }

  }

  ListView _buildListViewOfDevices() {
    List<Container> containers = new List<Container>();
    for (BluetoothDevice device in widget.devicesList) {
      containers.add(
        Container(
          height: 50,
          child: Row(
            children: <Widget>[
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: <Widget>[
                    Text(device.name == '' ? '(unknown device)' : device.name)
                  ],
                ),
              ),
              FlatButton(
                color: Colors.purple[800],
                child: Text(
                  'Connect',
                  style: TextStyle(color: Colors.white),
                ),
                onPressed: () {
                  widget.flutterBlue.stopScan();
                  widget.devicesList.length = 0;
                  if (widget.activity == 'power') {
                    Navigator.push(
                        context,MaterialPageRoute(builder: (context) => HowMuchPower(connectDevice: device)));
                  } else if (widget.activity == 'collectData') {
                    Navigator.push(
                        context,MaterialPageRoute(builder: (context) => CollectData(connectDevice: device)));
                  }
                },
              ),
            ],
          ),
        ),
      );
    }

    return ListView(
      scrollDirection: Axis.vertical,
      shrinkWrap: true,
      padding: const EdgeInsets.all(8),
      children: <Widget>[
        ...containers,
      ],
    );
  }

  @override
  Widget build(BuildContext context) {

    Widget okButton = FlatButton(
      child: Text("OK"),
      onPressed: () {
        Navigator.of(context, rootNavigator: true).pop();
      },
    );

    AlertDialog alert = AlertDialog(
      title: Text("Location Needed"),
      content: Text("RowingSTEM need access to your device location to use Bluetooth services on your device for the purposes of collecting data from the Concept2 Rowing Machine"),
      actions: [
        okButton,
      ],
    );

    Future.delayed(Duration.zero, () {
      showDialog(
        context: context,
        builder: (BuildContext context) {
          return alert;
        },
      );
    });

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.purple[800],
        title: Text('Available PM5 Monitors'),
      ),
      body: SafeArea(
          child: Column(
            children: <Widget>[
              FlatButton(
                child: Text('Scan For Devices',
                    style: TextStyle(
                        color: Colors.white
                    )),
                color: Colors.purple[800],
                textColor: Colors.purple[800],
                onPressed: () {
                  print('scan pressed');
                  if (widget.flutterBlue.isScanning != null) {
                    print('scan already in progress');
                  } else {
                    widget.devicesList.length = 0;
                    widget.flutterBlue.startScan();
                  }
                },
              ),
              _buildListViewOfDevices(),
            ],
          )
      ),
    );
  }
}