我想在我的 Flutter 应用程序中的其他组件的页面中添加一个选项卡控制器。我怎样才能做到这一点?当我添加 TabBar 时它没问题但是当我添加 TabBarView 时它不起作用。我附上了页面的截图。我想做这个。我怎么能在颤振应用程序中做到这一点。?
class Details extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new Column(
children: <Widget>[
new DropdownButton<String>(
items: <String>['USD', 'EUR', 'LTC'].map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (_) {},
value: 'USD',
),
new Text(
'\$6,146.76',
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 40.0,
color: Theme.of(context).accentColor,
),
),
new Text('Last Updated at'),
new DefaultTabController(
length: 2,
child: new Container(
child: new Column( …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序上使用了本机反应相机和叠加图像。现在我想使用按钮截取该屏幕的屏幕截图。但是当我截取屏幕截图时,图像上只显示覆盖图像。我还需要使用相机视图和叠加图像来捕获屏幕。
return (
<Camera
ref={(cam) => {
this.camera = cam;
}}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}
captureTarget={Camera.constants.CaptureTarget.disk}
>
<Image
style={{width: 400, height: 400}}
source={require('./image/shilpamela.png')}
/>
<TouchableHighlight
style={styles.capture}
//onPress={this.takePicture.bind(this)}
onPress={
() => {
captureScreen({
format: "jpg",
quality: 0.8
})
.then(
uri => {
CameraRollExtended.saveToCameraRoll({
uri: uri,
album: 'Name'
}, 'photo')
},
error => console.error("Oops, snapshot failed", error)
);
}
}
underlayColor="rgba(255, 255, 255, 0.5)"
>
<View>
<Image
style={{width: 60, height: 60}}
source={require('./image/cam_button.png')}
/>
</View>
</TouchableHighlight>
</Camera>
);Run Code Online (Sandbox Code Playgroud)