mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
[linting_tool] Add Adaptive Layout with Theming (#852)
This commit is contained in:
committed by
GitHub
parent
35f1670098
commit
8e73c73f4b
40
experimental/linting_tool/lib/app.dart
Normal file
40
experimental/linting_tool/lib/app.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2021 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:linting_tool/theme/app_theme.dart';
|
||||
import 'package:linting_tool/widgets/adaptive_nav.dart';
|
||||
import 'package:linting_tool/routes.dart' as routes;
|
||||
|
||||
class LintingTool extends StatefulWidget {
|
||||
const LintingTool({Key? key}) : super(key: key);
|
||||
|
||||
static const String homeRoute = routes.homeRoute;
|
||||
|
||||
@override
|
||||
_LintingToolState createState() => _LintingToolState();
|
||||
}
|
||||
|
||||
class _LintingToolState extends State<LintingTool> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Linting Tool',
|
||||
theme: AppTheme.buildReplyLightTheme(context),
|
||||
darkTheme: AppTheme.buildReplyDarkTheme(context),
|
||||
themeMode: ThemeMode.light,
|
||||
initialRoute: LintingTool.homeRoute,
|
||||
onGenerateRoute: (settings) {
|
||||
switch (settings.name) {
|
||||
case LintingTool.homeRoute:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (context) => const AdaptiveNav(),
|
||||
settings: settings,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user