73 lines
3.1 KiB
Dart
73 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:notube/dlForm/dl_form.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:notube/videoList/cubit/videos_cubit.dart';
|
|
|
|
class Home extends StatelessWidget {
|
|
Home({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('home').tr(),
|
|
),
|
|
body: LayoutBuilder(builder:
|
|
(BuildContext context, BoxConstraints viewportConstraints) {
|
|
return viewportConstraints.maxHeight < double.infinity
|
|
? Center(
|
|
child: Container(
|
|
constraints: viewportConstraints,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("assets/images/wallpaper.webp"),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Column(
|
|
children: <Widget>[
|
|
SizedBox(height: 10),
|
|
Text('home_intro').tr(),
|
|
SizedBox(height: 10),
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: DlForm()),
|
|
Flexible(
|
|
child: BlocConsumer<VideosCubit, VideosState>(
|
|
listener: (context, state) {},
|
|
builder: (context, state) {
|
|
return ListView.builder(
|
|
itemCount: state.videoList.length,
|
|
itemBuilder: (context, index) {
|
|
var currentVideo = state.videoList[index];
|
|
return ListTile(
|
|
leading: SizedBox(
|
|
width: 72,
|
|
height: 48,
|
|
child: Image.network(
|
|
currentVideo.thumbnail,
|
|
fit: BoxFit.cover),
|
|
),
|
|
title: Text(currentVideo.title),
|
|
subtitle: Text(
|
|
'${currentVideo.status} - ${currentVideo.format.format}'),
|
|
);
|
|
},
|
|
);
|
|
})),
|
|
],
|
|
),
|
|
),
|
|
)
|
|
: CircularProgressIndicator();
|
|
}));
|
|
}
|
|
}
|
|
/*
|
|
SingleChildScrollView(
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
minHeight: viewportConstraints.maxHeight),
|
|
child:
|
|
*/ |