我正在使用android studio,在扑动检查器中找不到切换平台模式。我在哪里可以找到它?
在应用的ThemeData中设置平台参数为TargetPlatform:
platform: TargetPlatform.iOS
代码示例:
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(
MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
// The line below forces the theme to iOS.
platform: TargetPlatform.iOS,
),
home: Scaffold(
body: Center(
child: TextField(),
),
),
),
);
}
原始答案