45 lines
1.1 KiB
Dart
Raw Normal View History

2021-07-22 18:04:24 +08:00
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
2021-07-22 17:06:53 +08:00
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
import 'package:flutter/material.dart';
class ViewWidget extends StatelessWidget {
final View view;
final Widget icon;
const ViewWidget({Key? key, required this.view, required this.icon})
: super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
2021-07-22 18:04:24 +08:00
onTap: _openView(context),
2021-07-22 17:06:53 +08:00
child: Container(
height: 30,
child: buildContent(),
));
}
Row buildContent() {
return Row(
children: [
icon,
const SizedBox(
width: 4,
),
Text(
view.name,
textAlign: TextAlign.start,
style: const TextStyle(fontSize: 15),
)
],
);
}
2021-07-22 18:04:24 +08:00
Function() _openView(BuildContext context) {
2021-07-22 17:06:53 +08:00
return () {
2021-07-22 18:04:24 +08:00
final stackView = stackViewFromView(view);
getIt<HomePageStack>().setStackView(stackView);
2021-07-22 17:06:53 +08:00
};
}
}