
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';

import '../../models/blog.dart';

class MobilePlainPage extends StatefulWidget {
  final Blog blog;

  const MobilePlainPage(this.blog, {Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return MobilePlainPageState();
  }

}

class MobilePlainPageState extends State<MobilePlainPage> {

  @override
  Widget build(BuildContext context) {
    Column col = Column(
      children: [],
    );
    col.children.add(Container(
      padding: EdgeInsets.only(top: 20, left: 16.0, right: 16.0, bottom: 16.0),
      child: Center(
        child: Text(
          widget.blog.title,
          style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 20,
          ),
        ),
      ),
    ));
    col.children.add(Container(
      padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 20.0),
      child: MarkdownBody(
        shrinkWrap: true,
        data: widget.blog.body,
      ),
    ));

    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios),
          onPressed: (){
            Navigator.of(context).pop();
          },
        ),
        title: Text(widget.blog.title),
        backgroundColor: Theme.of(context).primaryColor,
      ),
      body: SingleChildScrollView(
        child: col,
      ),
    );
  }
}