Files
derma_flutter/lib/config/app_context.dart
zhutao 99a1ce601e 1
2025-08-22 14:15:02 +08:00

23 lines
537 B
Dart

import 'package:flutter/material.dart';
class AppContext {
static late BuildContext _context;
AppContext._();
///私有构造函数,防止外部实例化
static void setContent(BuildContext context) {
_context = context;
}
///获取全局上下文
static BuildContext get context => _context;
///获取主题
static TextTheme get textTheme => Theme.of(_context).textTheme;
static ColorScheme get colorScheme => Theme.of(_context).colorScheme;
///页面内间距
static double get pagePadding => 15;
}