4

i have my application and i have changed its name and its shown correctly but when you see open applications on your phone , the app has no name but when you see its icon in the app list its shown correctly you will get the idea from the pictures

tested on 5 different devices

app icon in app list (shown correctly)

enter image description here

app name while seeing the opened applications

enter image description here

i don't know why this is happening i will share my manifest with you please tell me how to fix this problem

this is the AndroidManifest.xml

 package="com.eco.cat"> <!-- io.flutter.app.FlutterApplication is an android.app.Application that calls FlutterMain.startInitialization(this); in its onCreate method. In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> <application android:name="io.flutter.app.FlutterApplication" android:label="EcoCat" android:icon="@mipmap/ic_launcher"> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> <uses-permission android:name="android.permission.INTERNET"/> </manifest> 

my main.dart

import 'Front-end/home/Companies.dart'; import 'Front-end/search/Search.dart'; import 'Front-end/settings/Settings.dart'; import 'file:///D:/programming/Android_Development/Projects/coupon_app/lib/reusable_widgets/functions/Device_Information.dart'; import 'package:app/reusable_widgets/logic/Check_SiteStatus.dart'; import 'package:app/reusable_widgets/logic/Responsiveness-Controller.dart'; import 'package:curved_navigation_bar/curved_navigation_bar.dart'; import 'package:flutter/material.dart'; import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:provider/provider.dart'; import 'Themes/DarkThemeProvider.dart'; import 'Themes/DarkThemeStyle.dart'; import 'package:flutter/services.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitUp , DeviceOrientation.portraitDown]) .then((_) => runApp( Phoenix( child: MyApp(), ), ), ); } class MyApp extends StatefulWidget { // This widget is the root of your application. @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { DarkThemeProvider themeChangeProvider = new DarkThemeProvider(); @override void initState() { super.initState(); getCurrentAppTheme(); } void getCurrentAppTheme() async { themeChangeProvider.darkTheme = await themeChangeProvider.darkThemePreference.getTheme(); } Widget build(BuildContext context) { return ChangeNotifierProvider( create: (_) { return themeChangeProvider; }, child: Consumer<DarkThemeProvider>( builder: (BuildContext context, value, Widget child) { return MaterialApp( debugShowCheckedModeBanner: false, theme: Styles.themeData(themeChangeProvider.darkTheme, context), home: MyHomePage(), ); }, ), ); } } class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { //bottom navbar items to build body int _currentIndex = 1; final List<Widget> _children = [ Search(), CompaniesPage(), Settings(), ]; @override Widget build(BuildContext context) { //checks web server status checkSiteStatus(context); Color themeColor = Theme.of(context).backgroundColor; void changePage(int index){ setState(() { _currentIndex = index; }); } //setting app name based on current page String title = ''; if(_currentIndex == 0){ title = 'ابحث باستخدام التصنيفات'; }else if(_currentIndex == 1){ title = 'الشركات'; }else if(_currentIndex == 2){ title = 'الاعدادات'; } return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. bottomOpacity: 0.0, elevation: 0.0, title: new Center( child: Text('$title', style: TextStyle(color: Colors.white , fontSize: DeviceInformation(context).width * ResponsivenessController(context).responsiveFont ), ), ), ), body: _children[_currentIndex], bottomNavigationBar: CurvedNavigationBar( index: _currentIndex, color: themeColor, backgroundColor: Colors.cyan, height: 75.0, items:<Widget>[ Icon(Icons.search, size: DeviceInformation(context).height * ResponsivenessController(context).responsiveNavIcons), Icon(Icons.home, size: DeviceInformation(context).height * ResponsivenessController(context).responsiveNavIcons), Icon(Icons.settings, size: DeviceInformation(context).height * ResponsivenessController(context).responsiveNavIcons), ], onTap: changePage, ), ); } } 
3
  • is that the manifest file in android\app\src\main\AndroidManifest.xml? Commented Jul 2, 2020 at 18:28
  • yes it is the AndroidManifest sry for not explaining it earlier Commented Jul 2, 2020 at 18:41
  • Alright, I've just answered the question explaining why the title is not showing up and with links to the official docs Commented Jul 2, 2020 at 19:16

3 Answers 3

22
+50

MaterialAppis the entry point for a Flutter app using Material design, thus it should only be declared once in the MyApp widget. Docs for it is here.

As explained in the docs, the title property of the MaterialApp is the one that when seeing the opened Applications. The android:label in the AndroidManifest is the title that is shown on home screen.

You should set the title using the following code

return MaterialApp( debugShowCheckedModeBanner: false, theme: Styles.themeData(themeChangeProvider.darkTheme, context), home: MyHomePage(), title: "EcoCat", ); 
Sign up to request clarification or add additional context in comments.

3 Comments

you deserve the 50 reputation. Congratulations , i have one question though how should i set the color to white instead of black ?
i will give you the reputation in 29 minutes it just stackoverflow's policy
@thanks for the reputation. I don't believe you can can explicitly change the title color. It's color is built to always contrast with the primaryColor in your themes. If I do find a way to change it, I'll let you know.
1

use MaterialApp and set title for that. like this:

import 'package:flutter/material.dart'; main() => runApp(new MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return MaterialApp( title: 'Your_App_Name', home: DashboardPage(), ); } } 

3 Comments

please share some code or documentations MaterialApp is used everywhere in flutter you are talking general please be more specific
MaterialApp(title: 'Your_App_Name',) is the way.
Note : that this is not the AppBar() i have already set the AppBar this shows the app in opened apps list i will edit my image for more clarification
0
Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Home sweet home"), ), body: Home(), ); 

you better check the appbar whether you already have a title or not. and may be the title will be also missing from the main.dart

2 Comments

as i mentioned to dev001 , my app bar has a title and i will share my code for more clarification
why don't you add some padding to the body and see.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.