title: Reference to an enclosing class method cannot be extracted on refactoring
body: <p>When I want to do "Extract to widget", it raises an error : "reference to an enclosing class method cannot be extracted"</p>
  
  <p>I know there is some variables that must get their data from class constructor but I want Android studio to extract the widget then, I will correct the mistaken codes, like Visual Studio that without any error extract the code to a new widget then it needs to copy the new extracted widget to a new dart file and correct the mistakes.</p>
  
  <p>I want to extract the Card widget part.</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter/material.dart' as prefix0;
  import 'package:intl/intl.dart';
  import '../model/transaction.dart';
  
  class TransactionList extends StatelessWidget {
    final List&lt;Transaction&gt; transactions;
    final Function deleteTx;
  
    TransactionList(this.transactions, this.deleteTx);
  
    @override
    Widget build(BuildContext context) {
      return transactions.isEmpty
          ? LayoutBuilder(
              builder: (ctx, constraint) {
                return Column(
                  children: &lt;Widget&gt;[
                    Text(
                      'There is no transaction',
                      style: Theme.of(context).textTheme.title,
                      textDirection: prefix0.TextDirection.rtl,
                    ),
                    SizedBox(
                      height: 10,
                    ),
                    Container(
                        height: constraint.maxHeight * 0.6,
                        child: Image.asset(
                          'assets/images/yalda.png',
                          fit: BoxFit.cover,
                        ))
                  ],
                );
              },
            )
          : ListView.builder(
              itemCount: transactions.length,
              itemBuilder: (ctx, index) {
                return **Card**(
                  margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 5),
                  elevation: 5,
                  child: ListTile(
                    leading: CircleAvatar(
                      radius: 30,
                      child: Padding(
                        padding: const EdgeInsets.all(8),
                        child: FittedBox(
                            child: Text('\$${transactions[index].amount}')),
                      ),
                    ),
                    title: Text(
                      transactions[index].title,
                      style: Theme.of(context).textTheme.title,
                    ),
                    subtitle: Text(DateFormat.yMMMd()
                        .format(transactions[index].date)
                        .toString()),
                    trailing: MediaQuery.of(context).size.width &gt; 360
                        ? FlatButton.icon(
                            onPressed: () =&gt; deleteTx(transactions[index].id),
                            icon: const Icon(Icons.delete),
                            label: const Text('Delete'),
                      textColor: Theme.of(context).errorColor,
                    )
                        : IconButton(
                            icon: const Icon(Icons.delete),
                            color: Theme.of(context).errorColor,
                            onPressed: () =&gt; deleteTx(transactions[index].id),
                          ),
                  ),
                );
              });
    }
  }
  </code></pre>