When enter task menu(android), it shows "Flutter Demo" instead of my app label string in Manifest xml file. In the screen pages, I used scaffold with no app bar, hence no title, but there's safe area widget inside.
Where shall I edit in order to have custom app tile name.
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: SafeArea(
child: Column(
In MaterialApp() you have title property. You should change it in there.
MaterialApp(
title: 'HERE GOES YOUR TITLE',
home: Scaffold(
appBar: AppBar(
title: const Text('MaterialApp Theme'),
),
),
);
first of all use MaterialApp Widget and warp your whole Widget tree in MaterialApp widget
MaterialApp(
title: 'your app name',
home: Scaffold(
then edit name and description property in pubspec.yaml
name: your app name
description: your app description
then chnage android:label in AndroidManifest.xml
<application
android:label="your application name"
after all run flutter clean command and then flutter build
Try changing the name in pubspec.yaml file also like this
1) Open pubspec.yaml file.
2 Scroll to top .
3) change the name field to your app name which want to set
4) and set tile like this also
MaterialApp(
title: 'your app name',
home: Scaffold(
Related
I created a new Flutter app from scratch, in Android Studio. In one of my previous apps, I intentionally used a weird font style. Now, for some reason, the new app has the same fonts. Is it possible that I had stored some "global" font style somewhere in the Android Studio, and now it's getting re-used? How can I get rid of it and revert the "normal" fonts?
Here's the code of one widget and its screenshot in the emulator:
import 'package:flutter/material.dart';
class LoginScreen extends StatelessWidget {
#override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
child: Column(
children: <Widget>[
RaisedButton(
child: Text('Login'),
onPressed: () {
Navigator.pushNamed(context, '/');
},
),
Text('Login'),
],
),
),
);
}
}
No, there shouldn't be.
In my case it also appeared in the debug app, but disappeared again when I recompiled the project. I haven't seen it in a finished app yet.
I am an absolute beginner to Flutter !
Picture# 1 : Reference from tutorial.
Picture# 2 : My implementation.
Virtual Device: Nexus_5X_API_28
Android: 9.0
Are you sure you are using the same emulator in both examples?
The title in MaterialApp Widget isn't the title you will see in the Application Bar.
used by the device to identify the app
as documentation says.
So Maybe it is how the device displays 'running applications menu'.
If you want to display the appBar you need to use Scaffold
void main() => runApp(
MaterialApp(
title: 'App',
home: Scaffold(
appBar: AppBar(
title: Text('My App'),
),
body: Center(
child: Text("text"),
),
),
),
);
Is there a way to force an Flutter Android App to behave like it is on an iOS Device?
I'm not referring to the Cupertino package.
Here is what I mean with Android/iOS Style
iOS Style:
Android style:
You can set the platform parameter in the ThemeData of the app to TargetPlatform.iOS. Then the app will behave as if it were running on an iOS device, including showing iOS text controls, etc. Very useful for testing things out at least!
Here's a full app that will use iOS stylings even when run on an Android device:
import 'package:flutter/material.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(),
),
),
),
);
}
Edit
If you also want to fake defaultTargetPlatform, you can do that by setting debugDefaultTargetPlatform. Including that as well we have:
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
void main() {
// This line will fake defaultTargetPlatform to iOS.
debugDefaultTargetPlatform = TargetPlatform.iOS;
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(),
),
),
),
);
}
Update
This is not valid anymore with latest Flutter version
Solution from Previous Versions
Yes, it is possible during development stage, if that is what you want.
If the App is started from Intellij/Android studio, open Flutter Performance tab from Intellij/Android Studio, there you can find the option Platform and you can toggle it between iOS and Android.
If you are launching app from command line and using flutter devtools, in Devtools Web Interface, go to tab Flutter Inspector, there you can find the option Platform and you can toggle it between iOS and Android.
Use debugDefaultTargetPlatformOverride to force it, obviously in debug:
Widget build(BuildContext context) {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
return PlatformApp(
title: 'Lovey-Dovey',
home: MyHomePage(title: 'Lovey-Dovey2'),
);
}
Flutter will default the style to the native platform. So iOS/Android apps, while maintaining similar functionality, won't look out of place on the phone as they will follow Cupertino/Material guidelines respectively.
So I'm running the following code and no text is displayed on the emulator screen, the example app showed absolutely no text on screen. If I ran the app without a degugger attached, the text was there but disappeared when a refresh was made.
Same thing happens with API 24, 27, 28. On API 28 I didnt have any text in the home screen of the OS and sometimes half of the clock text was missing and half was there (like clock showed up as " :22" instead of "10:22"), app titles text under their icons was missing.
Tried reinstalling devices and downloading new images. Same thing happens if running with xamarin.
Some images showcasing the problem: https://imgur.com/a/OigLsCE
Has anyone had to deal with this before?
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}
Try changing the renderer in the emulator settings:
answer from https://www.reddit.com/r/androiddev/comments/dc8n2a/missing_text_in_android_emulator/f29dk6z?utm_source=share&utm_medium=web2x&context=3
I'm developing an app using Flutter, and I want to make sure it is accessible.
I have a drawer that I'm using as a navigation menu. When it is open and I use the screen reader the screen reader reads out: "Dismiss", "Home", "Conversations". I tried adding a semanticLabel, but it does not get read.
Here's a picture of the app and where I'm targeting with the screen reader
I want it to read out that the navigation menu is open, or at least change the "Dismiss" to something more informative like "Close navigation menu".
Where can I edit the "Dismiss" text, or where else can I add screen readable text to the drawer so users know when it is open?
My code for the drawer is as such:
Scaffold(
endDrawer: SizedBox(
width: 200,
child: Drawer(
semanticLabel: "Navigation Menu",
child: ListView(children: <Widget>[
ListTile(
title: Text("Home"),
onTap: () {
Navigator.pop(context);
}),
ListTile(
title: Text("Conversations"),
onTap: () {
Navigator.pop(context);
}
)
],
))),
appBar: AppBar(
...