我想要在我的应用程序栏中有一个 3 点弹出菜单按钮
它必须是可点击的 [导航到其他小部件、页面]
请告诉如何以更简单的方式添加弹出菜单按钮
import 'package:flutter/material.dart';
import 'dart:async';
void main() => runApp(MyApp());
//Using Bloc
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: bloc.darkThemeEnabled,
initialData: false,
builder: (context, snapshot) => MaterialApp(
theme: snapshot.data ? ThemeData.dark() : ThemeData.light(),
home: HomePage(snapshot.data)),
);
}
}
class HomePage extends StatelessWidget {
final bool darkThemeEnabled;
HomePage(this.darkThemeEnabled);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Dynamic Theme"),
),
body: Center(
child: Text("Hello World"),
),
drawer: Drawer(
child: ListView(
children: <Widget>[
ListTile(
title: Text("Dark Theme"), …Run Code Online (Sandbox Code Playgroud) 我想要一个在社交媒体上分享我的应用程序的功能。
共享图标将放置在应用栏内。当用户单击共享图标时,将向用户显示社交媒体选项。
我知道SHARE PACKAGE,但我不知道如何实现它。
请帮助我解决颤振应用程序中的此错误:
class MyApp extends StatelessWidget {
Future<bool> _onBackPressed(BuildContext context) {
return showDialog(
context:context,builder:(BuildContext context)=>AlertDialog(title: Text('Exit'),
actions: <Widget>[
FlatButton( child:Text('NO'),onPressed: ()=>Navigator.pop(context,false)),
FlatButton( child:Text('Yes'),onPressed: ()=>Navigator.pop(context,true))
],));
}
@override
Widget build(BuildContext context) {
return WillPopScope(onWillPop:_onBackPressed, // **the argument type Future<bool>Function(BuildContext) can not be assigned to parameter Future<bool>Function()**
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: Scaffold(
appBar: AppBar(title: Text('ListViews')),
body: BodyLayout(),
),
));
}
}
Run Code Online (Sandbox Code Playgroud)
Future<bool>_onBackPressed(BuildContext context) async{ 这个错误出现在错误框中错误:
the argument type Future<bool>Function(BuildContext) can not …Run Code Online (Sandbox Code Playgroud)