mirror of https://github.com/flutter/samples.git
[Gallery] Update desktop Rally for pages that did not have designs before (#314)
* Update desktop Rally for pages that did not have designs beforepull/320/head
parent
c1acfe799d
commit
d04440c11f
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,87 @@
|
|||||||
|
// Copyright 2020 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:gallery/layout/adaptive.dart';
|
||||||
|
import 'package:gallery/studies/rally/colors.dart';
|
||||||
|
|
||||||
|
class TabWithSidebar extends StatelessWidget {
|
||||||
|
const TabWithSidebar({
|
||||||
|
Key key,
|
||||||
|
@required this.mainView,
|
||||||
|
@required this.sidebarItems,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final Widget mainView;
|
||||||
|
final List<Widget> sidebarItems;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (isDisplayDesktop(context)) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||||
|
child: mainView,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Container(
|
||||||
|
color: RallyColors.inputBackground,
|
||||||
|
padding: EdgeInsetsDirectional.only(start: 24),
|
||||||
|
height: double.infinity,
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: sidebarItems,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SingleChildScrollView(child: mainView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SidebarItem extends StatelessWidget {
|
||||||
|
const SidebarItem({Key key, this.value, this.title}) : super(key: key);
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final textTheme = Theme.of(context).textTheme;
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: textTheme.body1.copyWith(
|
||||||
|
fontSize: 16,
|
||||||
|
color: RallyColors.gray60,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: textTheme.body2.copyWith(fontSize: 20),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
color: RallyColors.primaryBackground,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue