【问题标题】:My theme is not working properly can anyone find me a solution?我的主题无法正常工作,谁能找到我的解决方案?
【发布时间】:2021-03-17 04:57:04
【问题描述】:
import 'package:flutter/material.dart';

import 'first_page.dart';
import 'second_page.dart';

void main() {

  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  // This widget is the root of your application.
  
@override
  
Widget build(BuildContext context) {
  
  return MaterialApp(
  
    theme: ThemeData.dark().copyWith(
  
      primaryColor: Color(0xFF0A0E21),
  
    scaffoldBackgroundColor:Colors.black12,
  
    ),
  
   home: First_page(),
  
    routes: {
  
      '/zero': (context)=> First_page(),
  
      '/first':(context)=> Second_page(),
  
      //'/second':(context)=>Screen2(),
  
    },

  
  );
  
}

}

【问题讨论】:

标签: flutter flutter-theme


【解决方案1】:

请使用:

ThemeData(
       primaryColor: Color(0xFF0A0E21),
       scaffoldBackgroundColor:Colors.black12,
    ),

【讨论】:

    猜你喜欢
    • 2021-03-23
    • 1970-01-01
    • 2014-01-25
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 2023-01-31
    • 1970-01-01
    • 2022-10-17
    相关资源
    最近更新 更多