与AppBar一起实现列表视图多选方案的SIMPLEST方法是什么?因此,当选择多个项目时(例如,通过鼠标右键单击),它的行为与Windows 8开始屏幕完全相同.
我想显示应用栏以及第一个选定的列表视图项,我想用第二个,第三个等保持打开,我希望通过任何应用栏按钮操作(执行上下文操作)或通过其他系统范围的应用栏关闭操作(例如,右键单击其他位置,这将意味着上下文操作被取消).
我目前的实施太复杂了.我相信我一定错过了一些东西 - 这种基本和常见的场景必须能够以标准化的方式实施.
脚手架代码准备如下.如果只有此代码使用了应用栏,则在右键单击第二个列表视图项之前隐藏,再需要右键单击列表视图(不可接受).如果与IsSticky结合使用,则根本无法选择第二个列表视图项.
<Page
x:Class="ListViewAndAppBar.ExamplePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ListViewAndAppBar"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
DataContext="{Binding ExamplePageViewModel, Source={StaticResource Locator}}">
<Grid Background="Gray">
<ListView
x:Name="ListView"
ItemsSource="{Binding Persons}"
SelectionMode="Multiple"
SelectionChanged="ListView_SelectionChanged">
</ListView>
</Grid>
<Page.BottomAppBar>
<AppBar x:Name="BottomAppBar" Padding="10,0,10,0">
<Button x:Name="BottomAppBarBack" Tag="Back" Style="{StaticResource BackAppBarButtonStyle}" HorizontalAlignment="Left" />
</AppBar>
</Page.BottomAppBar>
</Page>
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.BottomAppBar.IsOpen = true;
//this.BottomAppBar.IsSticky = true;
}
Run Code Online (Sandbox Code Playgroud) 对于Windows 8的开发来说相当新,我正在开发一款具有相当扁平模型的应用程序.我看了看,但似乎无法找到如何设置WinJS页面以防止向后导航的明确答案.我已经尝试深入研究API,但它没有就此问题发表任何意见.
我试图使用的代码是
WinJS.Navigation.canGoBack = false;
Run Code Online (Sandbox Code Playgroud)
没有运气,它一直在抱怨只读属性,但是,没有setter方法可以改变它.
提前谢谢,〜肖恩
我已经从这个创建了一个新线程以避免混淆,因为有人告诉我Leftnav现在Drawer在Material-UI组件中.
我还有问题,第一个是ES7?这里显示的箭头函数的语法.我已经改为使用扁平链接的以下代码,以便尝试了解发生了什么:
import React, { Component } from 'react'
import { Drawer, AppBar, MenuItem} from 'material-ui'
import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import { Route, Router } from 'react-router'
export default class Header extends Component {
constructor(props){
super(props);
this.state = {open:false};
}
getChildContext() {
return {muiTheme: getMuiTheme(baseTheme)};
}
handleToggle() {
this.setState({open: !this.state.open});
console.log("open")
}
handleClose() { this.setState({open: false}); }
render() {
return (
<div>
<Drawer
docked={false}
open={false}>
<MenuItem onTouchTap={this.handleClose}>Menu Item …Run Code Online (Sandbox Code Playgroud) 我在应用栏动画方面遇到问题,我SilverAppBar在我的应用中使用, 。所以,问题是当我在我的列表中间并向上滚动时,应用栏不会出现,但它会在滚动到达项目列表顶部时出现。我已经测试了snap参数并给出了它true,但不是我期望的结果。我有为此创建自定义动画的想法,但我在 Flutter 方面经验不足,而且如果有一种方法可以添加参数或其他适合我的情况的小部件,那就太好了。
我正在使用的演示的实际代码:
Widget _search() => Container(
color: Colors.grey[400],
child: SafeArea(
child: Container(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
enabled: false,
style: TextStyle(fontSize: 16, color: Colors.white),
decoration: InputDecoration(
prefix: SizedBox(width: 12),
hintText: "Search",
contentPadding:
EdgeInsets.symmetric(horizontal: 32.0, vertical: 14.0),
border: InputBorder.none,
),
),
),
)),
);
Container _buildBody() {
return Container(
child: new GridView.count(
crossAxisCount: 2,
children: List.generate(100, (index) {
return Center(
child: Text(
'Item $index',
style: Theme.of(context).textTheme.headline,
),
);
}),
)); …Run Code Online (Sandbox Code Playgroud) 我有附加的 AppBar,我想在标题旁边添加图像,而不是操作图标,仅添加图像,我该如何处理这个问题?
appBar: AppBar(
title: Text('Title'),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.refresh),
onPressed: () {
setState(
() {
widget.athkarCategory.reset();
},
);
},
),
],
),
Run Code Online (Sandbox Code Playgroud)
Vuetifyv-app-bar有默认的CSS classesesv-toolbar__content和v-toolbar__extension,增加了16px对x轴和衬垫4px在y轴上,我想摆脱的。
我已经尝试在我的 css 中覆盖这些类,如下所示
.v-toolbar__content {
padding: 0px !important;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用。有人知道一些有助于摆脱填充的技巧v-app-bar吗?
如何减少按钮之间的间距?
您可以看到应用程序栏上的四个按钮占用了很多空间,我尝试过行。但没有工作
AppBar(
backgroundColor: Colors.deepOrange,
iconTheme: new IconThemeData(color: Colors.white),
title: Text(
titleString,
style: TextStyle(color: Colors.white),
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
//iconSize: 20,
onPressed: null,
),
IconButton(
icon: Icon(
Icons.notifications_none,
color: Colors.white,
),
// iconSize: 20,
onPressed: null,
),
//Add more icon here
],
);
Run Code Online (Sandbox Code Playgroud) 在 Material UI 的文档中,我找到了这段代码:
import React from 'react';
import PropTypes from 'prop-types';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/styles';
import CssBaseline from '@material-ui/core/CssBaseline';
import useScrollTrigger from '@material-ui/core/useScrollTrigger';
import Box from '@material-ui/core/Box';
import Container from '@material-ui/core/Container';
import Fab from '@material-ui/core/Fab';
import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp';
import Zoom from '@material-ui/core/Zoom';
const useStyles = makeStyles((theme) => ({
root: {
position: 'fixed',
bottom: theme.spacing(2),
right: theme.spacing(2),
},
}));
function ScrollTop(children) {
const classes = …Run Code Online (Sandbox Code Playgroud) 我想在我的 AppBar 中领先: Icon(Icons.settings) 到 ==> Text('Settings'),
当我刚刚做的时候 leading: Text('Cancel', style: TextStyle(fontSize: 20)),
并且需要像这样下来
基本上我想使前导成为文本而不是图标,这可能吗?
我无法使用 AppBar titleTextStyle 更改我的 AppBar 标题文本颜色。我知道我可以通过某些方式设置 AppBar 标题样式,例如在 textWidget 中使用样式或在 AppBar 中设置 textTheme,但我只想知道为什么不能通过设置 titleTextStyle 来更改它。
代码如下。尽管设置了 titleTextStyle 和 foregroundColor,AppBar 标题仍然是白色的。
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
foregroundColor: Colors.black,
titleTextStyle: TextStyle(color: Colors.black),
title: const Text('AppBar Color'),),
body: const Center(
child: Text('sample'),
),
);
}
}
Run Code Online (Sandbox Code Playgroud) appbar ×10
flutter ×5
dart ×3
material-ui ×2
windows-8 ×2
animation ×1
c# ×1
css ×1
drawer ×1
ios ×1
javascript ×1
jsx ×1
navigation ×1
reactjs ×1
scroll ×1
vue.js ×1
vuetify.js ×1
winjs ×1
xaml ×1