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-26 15:25:30 +08:00
|
|
|
import 'package:flowy_infra_ui/widget/spacing.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;
|
2021-07-26 15:25:30 +08:00
|
|
|
const ViewWidget({Key? key, required this.view}) : super(key: key);
|
2021-07-22 17:06:53 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-07-24 18:55:13 +08:00
|
|
|
return InkWell(onTap: _openView(context), child: buildContent());
|
2021-07-22 17:06:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Row buildContent() {
|
|
|
|
return Row(
|
|
|
|
children: [
|
2021-07-26 15:25:30 +08:00
|
|
|
const Image(
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
image: AssetImage('assets/images/file_icon.jpg')),
|
|
|
|
const HSpace(6),
|
2021-07-22 17:06:53 +08:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|