0

我把我所有的标签都放在AppLabels课堂上并拿来。在开发期间的调试模式下,它工作正常,但是当我运行"flutter build apk --release" 应用程序时,所有标签都没有显示在我的应用程序中。

我正在使用显示文本AppLabels.mytext

我的结果 APK 显示如下,没有文字

这是我的主要课程代码:

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  LocationPermission locationPermission = Get.put(LocationPermission());
  @override
  void initState() {
    locationPermission.getlocation();

    super.initState();
  }

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return Sizer(builder: (context, orientation, deviceType) {
      return GetMaterialApp(home: GettingStarted());
      // home: Home(),
    });
  }
}

这是我的应用标签类代码:

class AppLabels {
  static String gpsNavigation = "GPS Navigation";
  static String getStarted = "Get Started";
  static String allYouNeed =
      "All you need is the plan, the road map, and \n the courage to press on to your destination.";
  static String gettingStarted = "Get Started  >";
  static String agree = 'Agree ';
  static String termsOfServices = 'Terms of Services';
}

我像这样在我的应用程序中使用该标签

    // ignore_for_file: prefer_const_constructors

import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:navigation_project/Constants/app_colors.dart';
import 'package:navigation_project/Constants/app_images.dart';
import 'package:navigation_project/Constants/app_labels.dart';
import 'package:navigation_project/Constants/app_text_style.dart';
import 'package:sizer/sizer.dart';

import 'main_tabs_screen.dart';

class GettingStarted extends StatelessWidget {
  const GettingStarted({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Column(crossAxisAlignment: CrossAxisAlignment.center,
            // mainAxisAlignment: MainAxisAlignment.center,
            children: [
          SizedBox(
            height: 50.h,
            width: 60.w,
            child: Image.asset(
              AppImages.papermap,
              // fit: BoxFit,
            ),
          ),
          Padding(
            padding: EdgeInsets.only(left: 5.w, right: 5.w),
            child: Text(
              AppLabels.gpsNavigation,
              style: AppTextStyle.poopinsRegularBlack33,
            ),
          ),
          Padding(
            padding: EdgeInsets.only(top: 2.0.h, left: 5.w, right: 5.w),
            child: Text(
              AppLabels.allYouNeed,
              textAlign: TextAlign.center,
              style: AppTextStyle.poopinsRegularBlack12,
            ),
          ),
          SizedBox(height: 10.h),
          ElevatedButton(
            onPressed: () {
              Get.to(() => MainTabPage());
            },
            child: Text(
              AppLabels.getStarted,
              style: AppTextStyle.poopinsRegularBlack14
                  .copyWith(color: AppColors.kwhite),
            ),
          ),
          SizedBox(height: 8.h),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Radio(value: 0, groupValue: 0, onChanged: (a) {}),
              Text.rich(TextSpan(children: <InlineSpan>[
                TextSpan(
                  text: AppLabels.agree,
                  style: AppTextStyle.poopinsRegularBlack11,
                ),
                TextSpan(
                  text: AppLabels.privacyPolicy,
                  style: AppTextStyle.poopinsRegularBlue11
                      .copyWith(decoration: TextDecoration.underline),
                ),
                TextSpan(
                  text: ' & ',
                  style: AppTextStyle.poopinsRegularBlack11,
                ),
                TextSpan(
                  text: AppLabels.termsOfServices,
                  style: AppTextStyle.poopinsRegularBlue11
                      .copyWith(decoration: TextDecoration.underline),
                )
              ])),
            ],
          ),
        ]));
  }
}

在开发过程中导致调试模式:

开发过程中的结果

运行后的结果flutter build apk --release

apk 构建后

空格包含文本,但其中没有文本

4

0 回答 0