initial commit
This commit is contained in:
41
lib/ui/screen/home.dart
Normal file
41
lib/ui/screen/home.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:survive_app/ui/style/dimensions.dart';
|
||||
import 'package:survive_app/ui/viewmodel/drag_sheet_viewmodel.dart';
|
||||
import 'package:survive_app/ui/viewmodel/home_viewmodel.dart';
|
||||
import 'package:survive_app/ui/widget/nav_drawer.dart';
|
||||
import 'package:survive_app/ui/widget/drag_sheet.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
final HomeViewmodel vm;
|
||||
const HomeScreen({super.key, required this.vm});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: vm.scaffoldKey,
|
||||
backgroundColor: Colors.grey,
|
||||
drawer: NavDrawer(),
|
||||
body: Stack(
|
||||
children: [
|
||||
FlutterMap(
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate:
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
subdomains: const ['a', 'b', 'c'],
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => vm.openDrawer(),
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(Margins.small),
|
||||
icon: Icon(Icons.menu, color: Colors.black),
|
||||
),
|
||||
DragSheet(vm: DragSheetViewmodel()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
22
lib/ui/screen/router.dart
Normal file
22
lib/ui/screen/router.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:survive_app/data/wikipedia/repository.dart';
|
||||
import 'package:survive_app/ui/screen/home.dart';
|
||||
import 'package:survive_app/ui/screen/wikipedia.dart';
|
||||
import 'package:survive_app/ui/viewmodel/home_viewmodel.dart';
|
||||
import 'package:survive_app/ui/viewmodel/wikipedia_viewmodel.dart';
|
||||
|
||||
final GoRouter router = GoRouter(
|
||||
initialLocation: "/",
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: "/",
|
||||
builder: (context, state) => HomeScreen(vm: HomeViewmodel()),
|
||||
),
|
||||
GoRoute(
|
||||
path: "/wikipedia",
|
||||
builder: (context, state) => WikipediaScreen(
|
||||
vm: WikipediaViewmodel(wikipediaRepo: WikipediaRepository()),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
86
lib/ui/screen/wikipedia.dart
Normal file
86
lib/ui/screen/wikipedia.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:survive_app/ui/style/colors.dart';
|
||||
import 'package:survive_app/ui/style/dimensions.dart';
|
||||
import 'package:survive_app/ui/viewmodel/wikipedia_viewmodel.dart';
|
||||
import 'package:survive_app/ui/widget/status_bar_spacer.dart';
|
||||
|
||||
class WikipediaScreen extends StatelessWidget {
|
||||
final WikipediaViewmodel vm;
|
||||
const WikipediaScreen({super.key, required this.vm});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(Margins.small),
|
||||
child: Column(
|
||||
spacing: Margins.small,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusBarSpacer(),
|
||||
IconButton(
|
||||
onPressed: () => vm.returnClick(context),
|
||||
icon: Icon(Icons.arrow_back_outlined),
|
||||
),
|
||||
Text(
|
||||
"Wikipedia",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: TextSizes.large,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
cursorColor: ColorPalette.primary,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorPalette.secondary,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(100),
|
||||
),
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {},
|
||||
color: Colors.black,
|
||||
icon: Icon(Icons.download, size: 18),
|
||||
),
|
||||
),
|
||||
hintText: "Podaj tytul artykulu...",
|
||||
filled: true,
|
||||
fillColor: ColorPalette.secondary,
|
||||
focusColor: Colors.transparent,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
),
|
||||
),
|
||||
controller: vm.controller,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: vm.articles,
|
||||
builder: (context, value, child) {
|
||||
return Column(
|
||||
children: value.map((a) => Text(a.title)).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user